哪位知道修改popupmenu颜色的方法?(50分)

  • 主题发起人 主题发起人 snail-2
  • 开始时间 开始时间
S

snail-2

Unregistered / Unconfirmed
GUEST, unregistred user!
哪位高手知道修改popupmenu颜色的方法?
 
设置菜单的ownerdraw属性为true
procedure TForm1.PopDrawItem(Sender: TMenuItem;
ACanvas: TCanvas;
ARect: TRect;
Selected: Boolean;
strOUt: String);
begin
if Selected then
begin
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Color := $00ff00ff;
ACanvas.FillRect(ARect);
end
else
begin
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Color := $0000ffff;
ACanvas.FillRect(ARect);
end;
ACanvas.TextOut(ARect.Left+15,ARect.Top,strOut);
end;
//菜单某一项的onDrawItem事件里面调用PopDrawItem函数
procedure TForm1.N31DrawItem(Sender: TObject;
ACanvas: TCanvas;
ARect: TRect;
Selected: Boolean);
begin
PopDrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'N31');
end;

 
接受答案了.
 
后退
顶部