Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Adding MenuItem in InitializeContextMenu
posted

I have used the following code to add a Close All But This menuitem for the tabs.

EventHandler

 

handler = delegate(object s, EventArgs args)

{

CloseAllButThis(e.Tab.Form);

};

e.ContextMenu.MenuItems.Add(Resources.

Resource.CloseAllButThis, handler);

The code works perfect, but the MenuItem looks horrible! Is there any way to add a good looking MenuItem to the popup menu? Now it has a different font, highlightning get stucked after the mouse moves to another menu item and so on.

 

 

 

  • 44743
    posted

    Instead of calling the Add method of the MenuItems collection, try to instead create an Infragistics.Win.IGControls.IGMenuItem instance. This is our derived MenuItem type which has a different appearance from the normal menu item. Create an instance of that and add that to the MenuItems collection.