win98中开始按钮的菜单谁会做

I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
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;
 
顶部