Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   listBox con Imagenes (https://www.clubdelphi.com/foros/showthread.php?t=71958)

bitbow 20-01-2011 20:06:30

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;


La franja horaria es GMT +2. Ahora son las 04:01:55.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi