views:

30

answers:

3

I am disabling the parent menu option in a Windows forms menustrip. When you hover over it, the submenu still opens. Is there a way to disable the submenu opening or do I have to disable all the submenu items?

A: 

Just set the Enableproperty on the parent menu to False. In .net 2.0 and 3.5 the submenu will not show.

Also please try to be a little more specific.

Liviu M.
+1  A: 

Having the menu drop down show on mouse hover does not seem to be the default behavior of a ToolStripMenuItem and I could not find a property to enable this.

I did find this post by someone who wanted this behavior, and you should check to see if there is a MouseHover event handler for the ToolStripMenuItem and check the Enabled property there:

private void toolStripMenuItem1_MouseHover(object sender, EventArgs e)
{
    if (toolStripMenuItem1.Enabled)
        toolStripMenuItem1.DropDown.Show(menuStrip1, new Point(0, 0));
}

HTH

adrift