Sé que es una pregunta muy tonta, pero no la resuelvo por incompatibilidad entre los tipos Integer y Double.
Qué me falta para poder centrar el texto dentro de una celda de un TStringGrid ?
Código Delphi
[-]
procedure TMaster.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
Txt: String;
Lon: Byte;
begin
Txt := StringGrid1.Cells[ACol,Arow];
If ACol = 0 then
StringGrid1.Canvas.TextRect(Rect,Rect.Left+3,Rect.Top,Txt)
else
begin
Lon := Canvas.TextWidth(Txt);
StringGrid1.Canvas.TextRect(Rect,Lon,Rect.Top,Txt);
end;
Si pongo
Código Delphi
[-]
Lon := Canvas.TextWidth(Txt)/2;
me dá error.
Gracias