LCL, grid, take in count column title in autosizecolumn

git-svn-id: trunk@20665 -
This commit is contained in:
jesus 2009-06-18 17:03:22 +00:00
parent e3b36fe253
commit 803987e295

View File

@ -8452,6 +8452,7 @@ var
Ts: TSize;
TmpCanvas: TCanvas;
DC: HDC;
C: TGridColumn;
begin
if (aCol<0) or (aCol>ColCount-1) then
Exit;
@ -8464,10 +8465,17 @@ begin
end else
TmpCanvas := Canvas;
C := ColumnFromGridColumn(aCol);
try
W:=0;
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
W := Ts.Cx;
end;