Registriert seit: 17. Jan 2007
1.169 Beiträge
Turbo Delphi für Win32
|
Re: Formatieren mit "format"
7. Feb 2008, 01:05
Ansonsten geht es auch etwas komplizierter.
Delphi-Quellcode:
uses ComCtrls, ExtCtrls;
function MessageDlgEx(const MsgCaption, Msg: String; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
var
i, NewHeight: Integer;
Lv: TListView;
Dlg: TForm;
LItem: TListItem;
LiColumn: TListColumn;
Img: TComponent;
begin
Dlg:= CreateMessageDialog(Msg, DlgType, Buttons);
with Dlg do
try
Caption := MsgCaption;
HelpContext := HelpCtx;
Lv:= TListView.Create(Dlg);
Lv.Top := 5;
Lv.Left := 5;
Lv.Width := Dlg.ClientWidth- Lv.Left * 2;
Lv.Height := 50;
Lv.Parent := Dlg;
Lv.Color := Dlg.Color;
Lv.BorderStyle := bsNone;
Lv.ViewStyle := vsReport;
Lv.ShowColumnHeaders := false;
LiColumn := Lv.Columns.Add;
LiColumn := Lv.Columns.Add;
LItem := Lv.Items.Add;
LItem.Caption := 'Zeile1';
LItem.SubItems.Add('567');
LItem := Lv.Items.Add;
LItem.Caption := 'Zeile2';
LItem.SubItems.Add('789');
LItem := Lv.Items.Add;
LItem.Caption := 'Zeile3';
LItem.SubItems.Add('679');
TImage(FindComponent('Image')).Visible:= false;
for i := 0 to Pred(ComponentCount) do
if Components[i] is TButton then
begin
NewHeight:= (Lv.Top* 2 + Lv.Height)- TButton(Components[i]).Top;
if NewHeight> 0 then
TButton(Components[i]).Top := TButton(Components[i]).Top + NewHeight
else
NewHeight := 0;
end;
Height := Height + NewHeight;
Result := ShowModal;
finally
Free;
end;
End;
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlgEx('Test', '', mtConfirmation, mbOKCancel , 0) = mrYes then
ShowMessage('Ok');
end;
Gruß bitsetter
"Viele Wege führen nach Rom" Wolfgang Mocker (geb. 1954), dt. Satiriker und Aphoristiker
|
|
Zitat
|