Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Display a bitmap in a menu item

 
Subscribe to the RSS feed for this forum  Forum Index -> EZShellExtensionsMFC
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Mon Oct 06, 2008 8:31 am    Post subject: HOWTO: Display a bitmap in a menu item

HOWTO: Display a bitmap in a menu item

Instead of using owner-drawn menu items (OnDrawMenuItem and OnMeasureMenuItem ), you can use the SetBitmap method if you only want to display a bitmap next to the text of the menu item. To do so, use the CShellMenuItem.SetBitmap method as follows :

void CKeyItem::GetMenuItems(CGetMenuitemsEventArgs& e)
{
CShellMenuItem* menuitem = e.menu->AddItem(_T("My Menu Item"));
CString filePath = "C:\\MyImage.bmp";
HBITMAP hBmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(),filePath,IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
menuitem->SetBitmap(hBmp);
}
Back to top
Display posts from previous:   
Forum Index -> EZShellExtensionsMFC All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group