Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
Hot Offer
Save your money!
Featured
Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

News Tips .NET Software VCL Software Partners  

Stick graphics in ListBox
Use OnDrawItem event for inserting graphics into Listbox or Combobox.
Change ItemHeight property for changing size of picture.
Don't forget change Style property to lbOwnerDrawFixed.

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
  Bitmap: TBitmap;
  R: TRect;
  Mas: array[1..3] of string;
  i: Integer;
begin
  Mas[1]:='Pict1.bmp';
  Mas[2]:='Pict2.bmp';
  Mas[3]:='Pict3.bmp';
  with (Control as TListBox).Canvas do
  begin
    Bitmap:=TBitmap.Create;
    FillRect(Rect);
    Bitmap.LoadFromFile('C:\Pictures\'+Mas[Index+1]);
    if Bitmap<>nil then
    begin
      R:=Bounds(
        Rect.Left+2, 
        Rect.Top+2, 
        Rect.Bottom-Rect.Top-2, 
        Rect.Bottom-Rect.top-2);
      StretchDraw(R,Bitmap);
    end;
    TextOut(Rect.Left+100,Rect.Top,Mas[Index+1]);
    Bitmap.Free;
  end;
end;

Related topics
Set a color lines in ListBox

For more
Delphi Help

Download source


Our Partner
DevArchive.com
Recommended
just4fun
Useful Resources
Win32.hlp Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
Newsletters
Subscribe to our news!    Subscribe to our news!


Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software