Hallo Klaus,
so könnte es funktionieren:
Delphi-Quellcode:
procedure MaximizeCol(sg: TStringGrid; index, minWidth: Integer);
var
iCol, iWidth: 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(minWidth, Width - iWidth);
end;
end;
Grüße vom marabu