发信人: powerjeep()
整理人: kingron(2000-12-05 19:11:26), 站内信件
|
var
bmp_windows : Timage ; //是一个Timage,事先读入一个长条形的位图
//将以下事件代码付给Tmenuitem的DrawItem事件中;
procedure TFrm_mainclient.Mitem_aboutDrawItem(Sender: TObject; ACanvas : TCanvas;
ARect: TRect; Selected: Boolean);
var
width1 ,height1 : integer ;
rc_tmp : Trect ;
Glyph : Tbitmap ;
OldBrushColor : Tcolor ;
begin
//
Acanvas.Draw(0,0,bmp_windows); //画一个长条的图
Width1 := 18 ;
Height1 := 18 ;
rc_tmp := Arect ;
Rc_tmp.left := img_windows.width+Arect.left;
ACanvas.TextRect(rc_tmp,rc_tmp.left+width1+5,rc_tmp.top+5,' '+Tmenui tem(sender).Caption);
if Tmenuitem(sender).imageindex >= 0 then
imagelist1.Draw(Acanvas,Arect.Left+5+img_windows.width,Arect.top+2 ,Tmenuitem(sender).imageindex,true)
else
if Tmenuitem(sender).Checked then
begin
Glyph := TBitmap.Create;
try // 以下为化小图标
Glyph.Transparent := True;
Glyph.Handle := LoadBitmap(0, PChar(OBM_CHECK));
OldBrushColor := ACanvas.Font.Color;
ACanvas.Font.Color := clBtnText;
ACanvas.Draw(Arect.Left+7+img_windows.width , Arect.top+2, Glyph );
ACanvas.Font.Color := OldBrushColor;
rc_tmp := Arect ;
Rc_tmp.left := Arect.Left+img_windows.width +4;
Rc_tmp.Top := Arect.top + 2 ;
Rc_tmp.Right := Rc_tmp.left + Glyph.Width +4;
Rc_tmp.Bottom := Arect.Bottom - 2 ;
DrawEdge(ACanvas.Handle, Rc_tmp, BDR_SUNKENOUTER, BF_RECT);
finally
Glyph.Free;
end;
end;
end;
-- …… 世界因你而美丽
世界有我更精彩 ……
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.130.6.8]
|
|