Unit unit1;
Interface
Uses Windows, Messages, Sysutils, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls;
type TForm1 = class (TForm) List1: TComboBox; Button1: TButton; procedure Button1Click (Sender: TObject); procedure FormCreate (Sender: TObject); procedure List1DrawItem (Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState) PRIVATE {Private Declarations}}
Var Form1: TFORM1;
IMPLEMENTATION
{$ R * .dfm}
Procedure tForm1.Button1Click (Sender: Tobject); Vars: string; begin randomize; s: = INTOSTR (Random (100)); // Last Here! Createdir (s); end; procedure tform1.formcreate (sender: TOBJECT); Varbit1, Bit2, Bit3, Bit4, Bit5, Bit6: Tbitmap; Begin List1.style: = CSOWNERDRAWVARIABLE; list1.ItemHeight: = 30; bit1: = tbitmap.create; bit1.loadfromfile ('c: / program files / oicq / face /1-1.bmp '); bit2: = tbitmap.create; bit2.loadfromfile (' c: / program files / oicq / face / 2-1.bmp '); bit3: = tbitmap.create; bit3.loadfromfile 'C: / program files / OICQ / face / 3-1.bmp'; bit4: = tbitmap.create; bit4.loadfromfile ('c: / program files / oicq / face / 4-1.bmp'); bit5 : = Tbitmap.create; Bit5.LoadFromFile ('C: / Program files / OICQ / Face / 5-1.bmp'); bit6: = tbitmap.create; bit6.loadfromfile ('C: / Program Files / OICQ / Face / 6-1.BMP '); list1.items.addObject (' icon 1 ', bit1); list1.items.addobject (' icon 2 ', bit2); list1.items.addObject (' icon 3 ', bit3) List1.items.addObject ('icon 4', bit4); list1.items.addObject ('icon 5', bit5); list1.items.a DDOBJECT ('icon 6', bit6); list1.itemindex: = 0;
procedure TForm1.List1DrawItem (Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); varBitmap: TBitmap; Offset: Integer; begin with (Control as TCombobox) .Canvas do begin FillRect (Rect); Bitmap: = TBitmap (List1.Items.Objects [index]); // bitmap: = Tbitmap.create; //imagelist1.getbitmap(index, bitmap); if Bitmap <> nil dam, brushcopy (bounds (rest.left 2, RECT). TOP 2, Bitmap.width, Bitmap.Height, Bitmap, Bounds (0, Bitmap.width, Bitmap.Height), CLRED; Offset: = Bitmap.width 8; TextOut (Rect.Left Offset, Rect.top, list1.items [index]); end;
END;
End.