procedure AutoFitable(AGrids: TStringGrid);
//传入TStringGrid对像即可, 2004/10/28,CoolSlob
var
I, J: Integer;
MaxLenRow: Integer;
CurRowLen: Integer;
begin
inherited;
for J := 0 to AGrids.ColCount - 1 do
begin
MaxLenRow := 0;
for I := 1 to AGrids.RowCount - 1 do
begin
CurRowLen := AGrids.Canvas.TextWidth(Trim(AGrids.Cells[J, I]));
//自适应宽度时,当值的最大宽度小于标题宽时,以标题宽为准。
if AGrids.Canvas.TextWidth(Trim(AGrids.Cells[J, 0])) CurRowLe...[ 查看全文 ]