![]() |
ColWidths dynamisch erzeugen
Tag zusammen,
ich habe mal wieder eine Frage an euch. Ich habe ein Sringgrid mit drei Col's. Die dritte Col sollte sich beim Resize der Haupform an die neue Größe anpassen. Aber lediglich die dritte Spalte. Jemand eine Idee für mich Planlosen? |
Re: ColWidths dynamisch erzeugen
Hallo,
vielleicht hilft dir diese Prozedur:
Delphi-Quellcode:
Grüße vom marabu
uses
Math; procedure MaximizeCol(sg: TStringGrid; index, minSize: Integer); var iCol, iRow, iWidth, iHeight: Integer; begin with sg do if (index < ColCount) and (index > 0) then begin iWidth := ColCount * GridLineWidth + Ord(BorderStyle) * 3; for iCol := 0 to Pred(ColCount) do if iCol <> index then Inc(iWidth, ColWidths[iCol]); ColWidths[index] := Max(minSize, Width - iWidth); end; end; |
Re: ColWidths dynamisch erzeugen
Ich habe es wie folgt gelöst:
Delphi-Quellcode:
iFixCol := 50;
StringGrid1.DefaultColWidth := ((StringGrid1.ClientWidth-iFixCol) div 2) - StringGrid1.GridLineWidth; StringGrid1.ColWidths[0] := iFixCol+(StringGrid1.ClientWidth-iFixCol) mod 2; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:14 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