dbGrid how-to edit column Title and Width lazarus / 7-LCL ---------------------------------------------------------------------- Anonymous · 2005-06-11 12:09 i can'not find.. can change Title and Widht and Fields of dbGrid in manual code Thanks Fernando ---------------------------------------------------------------------- matthijs · 2005-06-11 13:17 You can access them through the columns property of the DBGrid. ---------------------------------------------------------------------- jtiedeman · 2008-12-31 00:04 The only Column property I can find for TDBGrid is under Headings and apparently seems only to let us add one at a time. No size or attachment to any particular field in the data source. ---------------------------------------------------------------------- jesusr · 2008-12-31 06:50 drop a dbgrid on a form, make sure it's selected, press F11, this will bring Object Inspector to front, look for "columns" property, select the row for this property, there should appear a [...] button at the right, click it, this will bring Columns editor to front, now you can add columns to dbgrid, for each item you add a column will appear in dbgrid, selecting each item (column) will make object inspector to show its properties one of such properties it's "Fieldname", another it's "Title" which is expandable, once expanded there should be a "Caption" property which controls the title that appears in column. ---------------------------------------------------------------------- tatamata · 2009-01-01 17:21 Also, you can auto adjust columns to their contents (I think it is AutoAdjust procedure. Ther is also AutoFill property... You can also adjust columns to Title text width, by using this or similar procedure: procedure TFormMain.AdjustDBGridColumnsToTitles(var pDBGrid:TDBGrid); var   vTitleWidth:Integer;   vTextWidth:Integer;   I:Integer; begin   with pDBGrid do begin     //Adjust columns to titles width.     for I:=0 to Columns.Count-1 do begin       vTitleWidth:=Canvas.TextWidth(Columns.Title.Caption);       vTextWidth:=Columns.Width;       if(vTitleWidth>vTextWidth) then         begin           Columns.Width:=vTitleWidth+10;         end;     end;   end; end;