1. To add a horizontal scroll bar to the listbox
SendMessage (Listbox1->handle,lb_sethorizontalextent,listbox1->width + 32,0);
2. Add an icon to a ListBox
First you need to set the Style property of the listbox to lbownerdrawvariable;
const MARGIN = 2;//margin around each bitmap
//------------------------------------------------------------ ---------------
void __fastcall tform1::listbox1measureitem (twincontrol *control, int Index,
int &height)
{
Height = imagelist1->height + margin * 2;
}
//---------------------------------------------------------------------------
void __fastcall TForm1:: Listbox1drawitem (Twincontrol *control, int Index,
Trect &rect, townerdrawstate State)
{
//fill background.
Listbox1->canvas->fillrect (Rect);
//Draw an image.
Imagelist1->draw (Listbox1->canvas, rect.left + margin, rect.top + margin, Index);
//Draw the text.
String Text = listbox1->items->strings [Index]; The
//Center the text vertically in relation to the bitmap.
int off = (rect.bottom-rect.top-listbox1->canvas->textheight (text))/2;
Listbox1->canvas->textout (rect.left + imagelist1->width + 2 * margin,
Rect.top + off,text);
}