1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
| Bitmap1:=TBitmap.Create; Bitmap1.LoadFromFile('faild.bmp'); CheckListBox1.Items.AddObject('Bitmap 1', Bitmap1); .... procedure TForm1.CheckListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var Bitmap:TBitmap; Offset:Integer; begin offset:=0; with CheckListBox1.Canvas do begin FillRect(Rect); Bitmap:=TBitmap(CheckListBox1.Items.Objects[Index]); if Bitmap<>nil then begin BrushCopy(Bounds(Rect.Left+2,Rect.Top+2,10,10),Bitmap,Bounds(0,0,10,10),clred); Offset:=10; end; TextOut(Rect.Left+Offset,Rect.Top,CheckListBox1.Items[Index]); end; end; |