How to disable a menu item and all its sub menu items?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, friends,

I am using C#.net 2005 to create a windows application.

It has menu items, such as File, etc.
Under File, there are more menu items, such as New Files, Working Files, etc.
Under New Files/Working Files, there are more sub menu items, respectively.

All those menu items are enabled at beginning.

It requires that:
If a user clicks on a sub menu of New Files, New Files menu and
all its sub menu items will be disabled;
If a user clicks on a sub menu of Working Files, Working Files
menu and all its sub menu items will be disabled.

In my source code, once a user clicks on a sub menu of New Files, I set
newFilesStripMenuItem.Enabled = false;
hoping that it will disable New Files menu and all its sub menu items
without writting 10 more lines to disable each its sub menu items one by one.

To my surprise, when I moved mouse pointer from Working Files menu (which
was still enabled and automatically displayed all its sub menu items while
moving mouse pointer) to New Files menu, all sub menu items of New Files menu
was displayed!

I was expecting all those sub menu items should NOT be displayed since New
Files menu was DISABLED. (Indeed, if I put mouse pointer on New Files menu
first without moving from Working Files menu, or if I clicked on New Files
menu directly, all those sub menu items could be NOT displayed)

Any ideas? Thanks a lot.
 
(Indeed, if I put mouse pointer on New Files menu first without moving from
Working Files menu, or if I clicked on New Files menu directly, all those
sub menu items could be NOT displayed)

should be:

(Indeed, if I put mouse pointer on New Files menu first without moving from
Working Files menu, or if I clicked on New Files menu directly, all those
sub menu items could NOT be displayed)
 
Back
Top