Ver Mensaje Individual
  #1  
Antiguo 12-11-2024
compuin compuin is offline
Miembro
 
Registrado: oct 2010
Posts: 230
Reputación: 15
compuin Va por buen camino
Como agregar una imagen de una ImageList en un Stringgrid

Hola amigos,

Tengo este codigo pero no tengo idea de como agregar las imagenes que tengo almacenadas en un Imagelist. Si alguien me puede orientar estare agradecido

Código:
procedure TFormMain.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
  Alin: integer;
begin
  with Sender as TStringGrid do
  begin
    if ARow = 0 then
       Alin:= DT_CENTER
    else
       Alin:= DT_RIGHT;

    if ACol = 0 then
       Alin:= DT_LEFT;

     if ARow = 0 then
       Alin:= DT_CENTER;

    // Dibujar texto centrado horizontal y verticalmente o a la derecha
    InflateRect(Rect, -1, -1);
    Canvas.FillRect(Rect);
    InflateRect(Rect, -3, -3);
    DrawText(Canvas.Handle, PAnsiChar(Cells[ACol, ARow]), Length(Cells[ACol, ARow]), Rect,
        Alin or DT_VCENTER or DT_SINGLELINE);
  end;
end;
Responder Con Cita