procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
bTemp:TBitmap;
begin
bTemp:=TBitmap.Create;
if Indexthen
begin
ImageList1.GetBitmap(Index,bTemp);
end;
with (Control as TComboBox) do
begin
Canvas.FillRect(Rect);
Canvas.TextOut(Rect.Left+ImageList1.Height+2,Rect.Top,Items[Index]);
Canvas.Draw(Rect.Left,Rect.Top,bTemp);
end;
bTemp.Free;
end;
|