Skip to content

Add new item change catch for MenuItem 'Visible' property #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions System/Windows/Forms/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,14 @@ internal virtual void ItemsChanged(int change)
{
DestroyMenuItems();
}
else if ((uint)change == 4)
{
DestroyMenuItems();
CreateMenuItems();
foreach (MenuItem item in MenuItems) {
item.UpdateMenuItem(true);
}
}
}

private IntPtr MatchKeyToMenuItem(int startItem, char key, MenuItemKeyComparer comparer)
Expand Down
2 changes: 1 addition & 1 deletion System/Windows/Forms/MenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ internal bool Visible
if ((state & 0x10000) == 0 != value)
{
state = (value ? (state & -65537) : (state | 0x10000));
ItemsChanged(1);
ItemsChanged(4);
}
}
}
Expand Down