Here's how to match Column title alignement with field alignement.
Usage: AlignTitles(DBGrid1) ;
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure AlignTitles(Grid : DBGrid) ;
var
j, k: Integer;
begin
with Grid.DataSource.DataSet do
for j := 0 to -1 + DBGrid1.FieldCount do
for k := 0 to -1 + FieldCount do
if Fields[k].FieldName = Grid.Fields[j].FieldName then
Grid.Columns[j].Title.Alignment := Fields[k].Alignment;
end; (* AlignTitles *)
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» How to sort items in a TList object
« Delphi: Incompatible type: 'method pointer and regular procedure' - explained

