resaze DBGrid to fit displayed columns.
Posted on 2001-08-04
I want to make dbgrid(also parent form) to fit columns shown there.
i have followng code :
procedure TTableForm.FormShow(Sender: TObject);
for I := 0 to DBGrid1.Columns.Count - 1 do // Iterate
end; // for
if www<500 then
width:=www+50 // 50 is for scrollbar and dbIndicator column
but seems it isnt work ok.
when this procedure occurs database table is already opened, so it should count columnt widths and add 50 pixels for scrollbar and indicator column. but somethng is wrong. On some table it shows more space than needed, and on some oter table it shows less width then needed. How to make this dbgrid(form) to fit exactly to displayed dbgrid clumns?
Does anyone knows how to help me?
thanks in advance.