Board index » delphi » resizing DBGrid columns and showing column titles

resizing DBGrid columns and showing column titles

I am using Delphi 4.
I have on a form a DBGrid.  I have titles displayed in the Grid with the
option of No column lines.

Firstly, I would like to see column lines in between the title of the
Grid (I don't really want to use a THeader control if at all possible)
and if possible, I would like to stick with the DBGrid.

Second, I am letting the user resize the columns in the Grid, but I
would like to keep track of the column resizing so that the next time
that the user starts the app again, the size of the columns will be left
to the same as the previous size.  Ideally, not letting the user resize
a number of columns to a size that would make a horizontal scroll bar
visible.  (Ie, I do not want the user to see the horizontal scroll bar
at all)

Thanks

--
-----------------------------------------------------------
Patrick Sabourin B.Sc. (Comp. Sci.)
email: patrick_sabou...@technologist.com
web site: http://surf.to/patrick-sabourin

"Even a mosquito doesn't get a slap on the back until
 he starts to work."
                     -Unknown
-----------------------------------------------------------

 

Re:resizing DBGrid columns and showing column titles


On Sun, 10 Oct 1999 18:46:04 -0500, Patrick Sabourin

Quote
<patrick_sabou...@technologist.com> wrote:
>Second, I am letting the user resize the columns in the Grid, but I
>would like to keep track of the column resizing so that the next time
>that the user starts the app again, the size of the columns will be left
>to the same as the previous size.  Ideally, not letting the user resize
>a number of columns to a size that would make a horizontal scroll bar
>visible.  (Ie, I do not want the user to see the horizontal scroll bar
>at all)

TMyDBGrid = class(TDBGrid)
protected
   FOnColResize: TNotifyEvent;
   procedure ColWidthsChanged; override;
public
   property OnColumnResize: TNotifyEvent read FOnColResize
     write FOnColResize;
end;

procedure TMyDBGrid.ColWidthsChanged;
begin
   inherited;
   if Assigned(FOnColResize) then
      FOnColResize(self);
end;

HTH,

Jan

Other Threads