Ver Mensaje Individual
  #1  
Antiguo 20-01-2011
bitbow bitbow is offline
Miembro
 
Registrado: jul 2006
Posts: 366
Reputación: 18
bitbow Va camino a la fama
Smile listBox con Imagenes

Saludos, despues de buscar por los foros como realizar esto no encontre algo en concreto, si hay informacion pero no algo asi como aqui esta el codigo no encontre.

Añadir imagenes a un ListBox, supongo que funcionara para otros componentes aunque no lo he probado, espero les sea de utilidad.

Aqui esta el codigo:
Código Delphi [-]
procedure TForm1.ComboBox1DrawItem(
    Control: TWinControl; 
    Index:Integer;  
    Rect: TRect; 
    State: TOwnerDrawState);
begin
  (* This ensures the correct highlite color is used *)
  combobox1.canvas.fillrect(rect);  

  (* This line draws the actual bitmap*)
  imagelist1.Draw(comboBox1.Canvas,rect.left,rect.top,Index);

  (*  This line writes the text after the bitmap*)
  combobox1.canvas.textout(rect.left+imagelist1.width+2,rect.top,
                          combobox1.items[index]);
end;
Responder Con Cita