Hola de nuevo.
Y si deseas centrar los textos de las celdas para una mejor presentación:
Código Delphi
[-]
procedure TForm1.FormCreate(Sender: TObject);
begin
with DBGrid1 do
begin
Options := DBGrid1.Options - [dgColumnResize];
Columns[2].Width := 120;
end;
with TStringGrid(DBGrid1) do
begin
DefaultRowHeight := 120;
RowHeights[0] := 20;
end;
end;
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
R: TRect;
begin
if (Column.FieldName = 'IMAGE') then
begin
with TPicture.Create do
try
Assign(Column.Field);
DBGrid1.Canvas.StretchDraw(Rect, BitMap);
finally
Free;
end;
end
else with TDBGrid(Sender) do
begin
R:= Rect;
FillRect( Canvas.Handle, R, HBRUSH(Color) );
DrawText( Canvas.Handle, PChar(Column.Field.AsString), -1, R,
DT_SINGLELINE + DT_VCENTER + DT_CENTER );
end;
end;
Muestra:
Saludos