unit uGrLista;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TfGrLista = class(TForm)
    lLista: TListBox;
    procedure FormCreate(Sender: TObject);
    procedure lListaDrawItem(Control: TWinControl; Index: Integer;
      Rect: TRect; State: TOwnerDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fGrLista: TfGrLista;

implementation

{$R *.DFM}

procedure TfGrLista.FormCreate(Sender: TObject);
Var B:TBitMap;
    i:Integer;
begin
    B:=TBitMap.Create;
    B.LoadFromFile('SMILE.BMP');
    For i:=1 to 10 Do
        lLista.Items.AddObject(IntToStr(i)+'. elem',B);
end;

procedure TfGrLista.lListaDrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
Var B:TBitMap;
begin
With (Control As TListBox).Canvas Do
   Begin
   FillRect(Rect);
   B:=TBitMap( (Control As TListBox).Items.Objects[Index] );
   if B<>nil Then
      Begin
//      Draw(Rect.Left+2,Rect.Top,B);
      BrushCopy(Bounds(Rect.Left + 2,Rect.Top, B.Width, B.Height),
                B,Bounds(0,0, B.Width, B.Height),
                clWhite);

      End;
   TextOut(Rect.Left+B.Width+4,Rect.Top,
           (Control As TListBox).Items[Index]);
   End;
end;

end.
