Programación General > C++ Builder

 Agregar Imagenes A Listbox, Combobox O Stringgrid

(1/2) > >>

betitono1:
Hola que tal como puedo agregar imagenes a un ListBox, ComboBox o StringGrid, me podian decir como hacerlo o en donde puedo econtrar informacion de esto.


Saludos

betitono1:
he encontrado un ejemplo en esta pagina

http://www.sources.ru/builder/gui/bitmap_i..._combobox.shtml

lo ejecuto y no me marca error pero no me muestra la imagen. Tendra que ver el tamaño del bmp?

_Viktor:
Hola, te aseguraste de que el ComBoBox tenga su propiedad Style en "csOwnerDrawVariable" ?

Ya que el codigo esta bien y hacen el siguiente comentario:

--- Citar ---Измените свойства Style в ComboBox и ListBox на csOwnerDrawVariable и lbOwnerDrawVariable

--- Fin de la cita ---

Es eso ?

betitono1:
y para el stringgrid como le hago

_Viktor:
Ehhh... De nada...

... Aqui esta el codigo para poner imagenes bmp en un StringGrid:


--- Código: Text ---//--------------------------------------------------------------------------------void __fastcall TForm1::LeerImagenes() { TPicture *picThis = new TPicture; String strTemp="c:\\foto.bmp"; picThis->LoadFromFile(strTemp); StringGrid1->Objects[0][0]=(TObject*) picThis->Graphic; }//-------------------------------------------------------------------------------- void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,       int ARow, TRect &Rect, TGridDrawState State) {   if(StringGrid1->Objects[ACol][ARow]!=0){       StringGrid1->Canvas->Draw(Rect.Left+0,       Rect.Top+0,(Graphics::TGraphic*)       StringGrid1->Objects[ACol][ARow]);   } } //-------------------------------------------------------------------------------- 
Y este corresponde si insertas imagenes jpeg en el StringGrid


--- Código: Text ---//--------------------------------------------------------------------------------void __fastcall TForm1::Button1Click(TObject *Sender) { TJPEGImage *foto = new TJPEGImage; String strTemp="D:\\avathar2.jpg"; foto->LoadFromFile(strTemp); StringGrid1->Objects[0][0]= foto;  } //--------------------------------------------------------------------------------void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,       int ARow, TRect &Rect, TGridDrawState State) {   if(StringGrid1->Objects[ACol][ARow]!=0)   {       StringGrid1->Canvas->Draw(Rect.Left+0,Rect.Top+0,(TJPEGImage*)       StringGrid1->Objects[ACol][ARow]);   } } //-------------------------------------------------------------------------------- 
Espero te sirva.
Saludos!

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

Ir a la versión completa