Board index » delphi » DBGrid col sizing without col moving

DBGrid col sizing without col moving

Does anyone have a quick fix for disabling the ability to move columns in a
DBGrid and yet retain the ability to change the column sizes?  I'm trying to
avoid a routine to move the columns back to their original position on the
OnColumnMoved event.  D4

Kind regards,

Django

 

Re:DBGrid col sizing without col moving


Quote
Django Dunn wrote:

> Does anyone have a quick fix for disabling the ability to move columns in a
> DBGrid and yet retain the ability to change the column sizes?  I'm trying to
> avoid a routine to move the columns back to their original position on the
> OnColumnMoved event.  D4

> Kind regards,

> Django

Declare a type:

Type
  THack = class (TCustomGrid);

Assuming your dbgrid is named DBGrid1, before the grid is displayed (in
FormShow event or similar) place the line of code:

THack(DBGrid1).Options := THack(DBGrid1).Options - [goColMoving];

Steve Elliott
selli...@compuserve.com

Re:DBGrid col sizing without col moving


Quote
>Assuming your dbgrid is named DBGrid1, before the grid is displayed (in
>FormShow event or similar) place the line of code:

>THack(DBGrid1).Options := THack(DBGrid1).Options - [goColMoving];

  Excellent!  Thank you Steve!

Django

Other Threads