Board index » delphi » DBGrid Column Widths

DBGrid Column Widths

I'm using DBGrids on various forms.  They have the following options
set:
  dgRowSelect = true
  dgAlwaysShowSelected = true
  dgColumnResize = false

These were set at design time, and do not change. I use the DBGrids to
view information not to edit.

My problem is that at runtime, all (not always) the column widths get
changed.  I set them all so that they fit at design time. How can I
overcome this?

TIA
Masiar

 

Re:DBGrid Column Widths


Use the fields editor a design time to add the fields required. You can
then set the Displaywidth property in the Object inspector.
Alternatively, you can set this property at run time e.g.
Table1.FieldbyName('MyField').Dispaywidth := 25; (in characters not
pixels)

Hope this helps.... Steve Griffiths

Quote
masiar laschai wrote:
> I'm using DBGrids on various forms.  They have the following options
> set:
>   dgRowSelect = true
>   dgAlwaysShowSelected = true
>   dgColumnResize = false

> These were set at design time, and do not change. I use the DBGrids to

> view information not to edit.

> My problem is that at runtime, all (not always) the column widths get
> changed.  I set them all so that they fit at design time. How can I
> overcome this?

> TIA
> Masiar

Other Threads