I have problem with column width in dbgrid in delphi. I get result from database and i has three columns ID
, Name
, Description
.
Name and description has width about 2000+
. I try to change in DBGrid > Columns > description > width = 300
but not work. Again when i compaile my columns has to much width
. How to slove this? I want to be ajusted in parent.
It is necessary to add columns object.
By IDE: right click on DBGrid, columns editor then "Add all fields..." By runtime: you must create a Column objects.
This is a small example:
var vColumn: TColumn;
begin
vColumn := DBGrid1.Columns.Add;
// Now you can assign the right properties
vColumn.Field := yourfield
vColumn.Width := yourwidth