procedure TForm1.Button1Click(Sender: TObject); var i, j: Integer; begin
with DBGrid1.DataSource.DataSet do
for i := 0 to DBGrid1.FieldCount - 1 do
for j := 0 to FieldCount - 1 do
if Fields[j].FieldName = DBGrid1.Fields[i].FieldName then DBGrid1.Columns[i].Title.Alignment := Fields[j].Alignment; end;