请解释一下 谢谢谢谢
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
Bitmap: TBitmap;
Offset: Integer;
begin
with (Control as TComboBox).Canvas do
begin
FillRect(Rect);
Bitmap := TBitmap(ComboBox1.Items.Objects[Index]);
if Bitmap <> nil then
begin
BrushCopy(Bounds(Rect.Left + 2, Rect.Top + 2, Bitmap.Width,Bitmap.Height),Bitmap,Bounds(0, 0, Bitmap.Width,Bitmap.Height), clRed);
Offset := Bitmap.width + 8;
end;
TextOut(Rect.Left + Offset, Rect.Top, Combobox1.Items[Index])
end;
end;
请解释一下
with (Control as TComboBox).Canvas do 这一句中 为什么要这样做啊 和
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
里的 Control: TWinControl 的关系是什么