PDA

Ver la Versión Completa : componentes combobox con icono


locango
07-07-2005, 18:31:43
alguien me puede ayudar como igreso un icono a un combobox adelante de la opcion o me pueden decir otro componente que haga eso pero que su forma sea como el combobox gracias

jachguate
07-07-2005, 19:06:07
Podes hacerlo en un combobox normal, poniendo su propiedad Style a csOwnerDrawFixed o csOwnerDrawVariable (dependiendo de si la altura de los items es variable o no), y luego escribiendo el evento OnDrawItem.

La misma ayuda de delphi dice:


Write an OnDrawItem event handler to draw the items in the drop-down list of an owner-draw combo box. An OnDrawItem event handler can add graphic elements to the list items, or replace the list item text by graphics.

Draw the items on the Canvas using the coordinates provided by the Rect parameter. OnDrawItem occurs only if Style is set to csOwnerDrawFixed or csOwnerDrawVariable.

If an OnDrawItem event handler is not provided, the combo box fills the Rect parameter with the current brush and writes the text value of the item specified by the Index parameter.


Hasta luego.

;)

roman
07-07-2005, 19:17:03
Ahora que, si usa D >= 6 bastaría usar un ComboBoxEx (paleta Win32)

// Saludos

locango
11-07-2005, 17:18:35
gracias por responder
y con el en que propiedad del ComboBoxEx puedo agregar iconos

roman
11-07-2005, 17:32:19
Los iconos los colocas en un TImageList y asignas éste a la propiedad Images del ComboBoxEx.

Agregas los items del combo con la propiedad ItemsEx y a cada item le asignas el índice (ImageIndex) del icono que quieres usar.

// Saludos

locango
11-07-2005, 22:18:09
una pregunta mas comopuedo hacer que en tiempo de ejecucion ingresen al ComboBoxEx todas los string que ingrese en el comboboxex que se vayan llenando y que solo muestre ocho y los demas con una lecha abajo