如题。

解决方案 »

  1.   

    将listbox的style属性设为lbOwnerDrawFixed
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      listbox1.Items.Add('111');
    end;procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
      Rect: TRect; State: TOwnerDrawState);
    var
     Bitmap: TBitmap;
     Offset: Integer;
    begin
      with (Control as TListBox).Canvas do
        begin
          FillRect(Rect);
          Offset := 2;
          Bitmap := TBitmap.create;
          Bitmap.LoadFromFile('D:\listbox\verisign.bmp');//图片位置
          BrushCopy(Bounds(Rect.Left+2,Rect.Top,
          Bitmap.Width,Bitmap.Height),
          Bitmap,Bounds(0,0,Bitmap.Width,
          Bitmap.Height),clRed);
          Offset := Bitmap.width+ 6;
          TextOut(Rect.Left+ Offset, Rect.Top,
          (Control as TListBox).Items[Index])
        end;end;ok!!!!