mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 08:19:29 +02:00
LCL, grid, take in count column title in autosizecolumn
git-svn-id: trunk@20665 -
This commit is contained in:
parent
e3b36fe253
commit
803987e295
@ -8452,6 +8452,7 @@ var
|
|||||||
Ts: TSize;
|
Ts: TSize;
|
||||||
TmpCanvas: TCanvas;
|
TmpCanvas: TCanvas;
|
||||||
DC: HDC;
|
DC: HDC;
|
||||||
|
C: TGridColumn;
|
||||||
begin
|
begin
|
||||||
if (aCol<0) or (aCol>ColCount-1) then
|
if (aCol<0) or (aCol>ColCount-1) then
|
||||||
Exit;
|
Exit;
|
||||||
@ -8464,10 +8465,17 @@ begin
|
|||||||
end else
|
end else
|
||||||
TmpCanvas := Canvas;
|
TmpCanvas := Canvas;
|
||||||
|
|
||||||
|
C := ColumnFromGridColumn(aCol);
|
||||||
|
|
||||||
try
|
try
|
||||||
W:=0;
|
W:=0;
|
||||||
for i := 0 to RowCount-1 do begin
|
for i := 0 to RowCount-1 do begin
|
||||||
Ts := TmpCanvas.TextExtent(Cells[aCol, i]);
|
|
||||||
|
if (i=0) and (FixedRows>0) and (C<>nil) then
|
||||||
|
Ts := TmpCanvas.TextExtent(C.Title.Caption)
|
||||||
|
else
|
||||||
|
Ts := TmpCanvas.TextExtent(Cells[aCol, i]);
|
||||||
|
|
||||||
if Ts.Cx>W then
|
if Ts.Cx>W then
|
||||||
W := Ts.Cx;
|
W := Ts.Cx;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user