J
Jamsonsu
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var Bitmap: TBitmap; Offset: Integer;
begin
offset:=0;
with ComboBox1.Canvas do
begin
FillRect(Rect);
Bitmap := TBitmap(ComboBox1.Items.Objects[Index]);
if Bitmap <> nil then {粘贴图片}
begin{适当的空档使图片关系分明,clred为透明色}
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; {图片与文字的间隔,以组件的Left属性计算}
end;
TextOut(Rect.Left+Offset, Rect.Top, Combobox1.Items[Index]); {显示文字}
end;
end;
BrushCopy中指定的源、目的位图,我想问:只是Copy而不是Cut,为何看不到源图象?
Rect: TRect; State: TOwnerDrawState);
var Bitmap: TBitmap; Offset: Integer;
begin
offset:=0;
with ComboBox1.Canvas do
begin
FillRect(Rect);
Bitmap := TBitmap(ComboBox1.Items.Objects[Index]);
if Bitmap <> nil then {粘贴图片}
begin{适当的空档使图片关系分明,clred为透明色}
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; {图片与文字的间隔,以组件的Left属性计算}
end;
TextOut(Rect.Left+Offset, Rect.Top, Combobox1.Items[Index]); {显示文字}
end;
end;
BrushCopy中指定的源、目的位图,我想问:只是Copy而不是Cut,为何看不到源图象?