高手请进来看看! 请教如何自定义菜单的一个事件(内详!)
1.BCB帮助中:MenuItem的OnAdvancedDraw (请注意:const)
typedef void __fastcall (__closure *TAdvancedMenuDrawItemEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Windows::TRect &ARect, TOwnerDrawState State);
2.直接在Object Inspector中双击OnAdvancedDraw产生一下代码(无const)
void __fastcall TForm1::N1AdvancedDrawItem(TObject *Sender,
TCanvas *ACanvas, TRect &ARect, TOwnerDrawState State)
{
}
3.问题:如何自定义菜单项的OnAdvancedDrawItem事件???
由于我的菜单项是动态生成,必须在程序中指定OnAdvancedDrawItem
item->OnAdvancedDrawItem = myAdvancedDrawItem;
由于const的存在,此句编译自然通不过,即使强制转换类型也不行
void __fastcall TForm1::myAdvancedDrawItem(TObject *Sender,
TCanvas *ACanvas, TRect &ARect, TOwnerDrawState State)
{
//其中需要更改ARect
}
各位有什么转换方法或者其它办法?