locked
Context Menu Strip Query RRS feed

  • Question

  • Hi All,

    I have context menu strip in which i have 4 context menus

    1.Add Serial Number Range
    2.Add Data Filter
    3.Modify Data Filter
    4.Delete Data Filter

    On some of the tab's when i RIGHT CLICK, need to show only 3 context menus

    like

    2.Add Data Filter
    3.Modify Data Filter
    4.Delete Data Filter

    And On some tab's on RIGHT CLICK

    1.Add Serial Number Range
    2.Add Data Filter
    3.Modify Data Filter
    4.Delete Data Filter

    So How should i do this? Is it possible to exclude any of the item from context menu...

    I am using SINGLE Context Menu Strip.....On design time have added these context menu's

    Any help on this is appreciated....

    Regards,

    Rohit Pundlik

    Thursday, May 3, 2012 1:09 PM

Answers

  • Hi,

    in the contextmenu popup event, you set the items visible property according to how you want it.


    Regards, Nico

    • Proposed as answer by Bob Wu-MT Thursday, May 10, 2012 3:30 AM
    • Marked as answer by Bob Wu-MT Friday, June 8, 2012 5:39 AM
    Thursday, May 3, 2012 1:21 PM
  • Hi Rohit,
    I agree with Nico, you can set the item visible property.
    If you are using a Context Menu Strip, you can set the visible property in the ContextMenuStrip.Opening event handler.
    I’m not sure what do you mean by tabs here. If you mean the tabpage in the tabcontrol, you can get current tabpage by using TabControl.SelectedTab Property.
    If you want to show the Context Menu Strip according to the current control, you can get the control by using Control.GetChildAtPoint Method.
    If there is anything unclear, please let us know.
    Best Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Bob Wu-MT Friday, June 8, 2012 5:39 AM
    Thursday, May 10, 2012 3:30 AM

All replies

  • Hi,

    in the contextmenu popup event, you set the items visible property according to how you want it.


    Regards, Nico

    • Proposed as answer by Bob Wu-MT Thursday, May 10, 2012 3:30 AM
    • Marked as answer by Bob Wu-MT Friday, June 8, 2012 5:39 AM
    Thursday, May 3, 2012 1:21 PM
  • Hi Rohit,
    I agree with Nico, you can set the item visible property.
    If you are using a Context Menu Strip, you can set the visible property in the ContextMenuStrip.Opening event handler.
    I’m not sure what do you mean by tabs here. If you mean the tabpage in the tabcontrol, you can get current tabpage by using TabControl.SelectedTab Property.
    If you want to show the Context Menu Strip according to the current control, you can get the control by using Control.GetChildAtPoint Method.
    If there is anything unclear, please let us know.
    Best Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Bob Wu-MT Friday, June 8, 2012 5:39 AM
    Thursday, May 10, 2012 3:30 AM