Hola wilcg.
En el evento
OnDrawColumnCell estas tomando el control de la salida del texto y por ese motivo ya no dispones de las alineaciones por defecto de las columnas.
Pero podes evaluar la alineación de la columna y actuar en consecuencia vg.:
Código Delphi
[-]
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
R : TRect;
uFormat: LongWord;
begin
uFormat := DT_SINGLELINE or DT_VCENTER or DT_END_ELLIPSIS;
case Column.Alignment of
taLeftJustify : uFormat := uFormat or DT_LEFT;
taRightJustify: uFormat := uFormat or DT_RIGHT;
taCenter : uFormat := uFormat or DT_CENTER;
end;
with TDBGridEh(Sender) do
begin
R := Rect;
Canvas.FillRect(R);
DrawText(Canvas.Handle, @Column.Field.AsString[1], -1, R, uFormat);
end;
end;
Saludos