Top of my head:
procedure SizeList(mylist:tStringGrid);
var
w,c,x,iLoop:integer;
begin
x:=mylist.Width;
w:=x div 100;
c:=mylist.ColCount;
for iLoop:=0 to c-1 do
begin
mylist.ColWidths[iLoop]:=w*c;
dec(x,ColWidths[iLoop])
end;
if x>0 then
mylist.ColWidths[c-1]:=mylist.ColWidths[c-1]+x;
end;
Hth - Chris
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Chris Stebbing
> Sent: 29 July 2007 09:32
> To: Delphi List
> Subject: auto sizing grid
>
> Hi All,
>
> I have Delphi 2005 (with the Jedi components installed as
> well). I would like a grid (either stringgrid or dataaware
> grid) that will automatically size itself to a panel. If the
> user resizes the form/panel I want it to auto-configure the
> number of rows and columns to fit within the allocated space,
> and add scrollbars if necessary.
>
> Does such a beast exist?
>
> If not, any ideas on the best way to go about doing something
> like this?
>
> Cheers,
> Chris.
>
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi