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 for the menu item in a context menu

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



Joined: 18 Jul 2005
Posts: 731

Posted: Mon Oct 06, 2008 8:26 am    Post subject: HOWTO: Display a bitmap for the menu item in a context menu

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 ShellMenuItem.SetBitmap method as follows :

[C#]
public override void GetMenuItems(GetMenuitemsEventArgs e)
{
ShellMenuItem menuItem =e.Menu.AddItem("My Menu Item");
menuItem.SetBitmap(new Bitmap("C:\\MyImage.bmp"));
}


[VB.Net]
Public Overrides Sub GetMenuItems(ByVal e As GetMenuitemsEventArgs)
Dim menuItem As ShellMenuItem = e.Menu.AddItem("My Menu Item")
menuItem.SetBitmap(New Bitmap("C:\MyImage))
End Sub
Back to top
Display posts from previous:   
Forum Index -> EZNamespaceExtensions.Net All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group