Ver Mensaje Individual
  #4  
Antiguo 27-05-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
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
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita