![]() |
Listview an der Anzahl von Symbole anpassen?
Hallo Alle!
Ich habe eine Form mit Listview daruf. Im Listview sind ab und zu mal 4 Symbole oder auch 16. Wie kann ich die Form und Listview dazu veranlassen, dass sie sich der Größe je nach Anzahl der Symbole anpasst? Gruß Heike |
Re: Listview an der Anzahl von Symbole anpassen?
So ähnlich könnte man es wohl machen:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var loop : integer; ItemRect: TRect; MaxWidth, MaxHeight : integer; begin MaxWidth := 0; MaxHeight := 0; for loop := 0 to pred(ListView1.Items.Count) do begin ItemRect := ListView1.Items.Item[loop].DisplayRect(drBounds); if ItemRect.Right > MaxWidth then MaxWidth := ItemRect.Right; if ItemRect.Bottom > MaxHeight then MaxHeight := ItemRect.Bottom; end; inc(MaxWidth, 4);//wegen Scrollbar inc(MaxHeight, 4); //Form anpassen Listview1.Parent.Width := Listview1.Parent.Width - Listview1.ClientWidth + MaxWidth; Listview1.Parent.Height := Listview1.Parent.Height - Listview1.ClientHeight + MaxHeight; //Listview Abmessung anpassen Listview1.ClientWidth := MaxWidth; Listview1.ClientHeight := MaxHeight; end; |
Re: Listview an der Anzahl von Symbole anpassen?
Zitat:
Gruß Heike |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:58 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz