Richard Payne
asked on
C# top menu, toolstripmenuitem, how to stop closing as I need to check several option
C#, VS2015. related to top menu where I have several toolstripmenuitem with list of option that I like to check thro, but I need to stop autohide.
I could not find closing event which enable to cancel closing. I do not see autohide to set false in property.
Please provide C# code example how to keep menu from closing, while checking until I finish with it (by clicking outside the pull down menu or escape key)
I could not find closing event which enable to cancel closing. I do not see autohide to set false in property.
Please provide C# code example how to keep menu from closing, while checking until I finish with it (by clicking outside the pull down menu or escape key)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is MenuStrip object
ASKER
It has DropItemClosed but no DropItemClosing event.
If you add these events to your code - you can keep the menu open till the mouse leaves:
bool MouseIn = false;
private void contextMenuStrip1_Closing( object sender , ToolStripDropDownClosingEventArgs e )
{
if ( MouseIn )
{
e.Cancel = true;
return;
}
}
private void contextMenuStrip1_MouseEnter( object sender , EventArgs e )
{
MouseIn = true;
}
private void contextMenuStrip1_MouseLeave( object sender , EventArgs e )
{
MouseIn = false;
}
ASKER
Wiliams
Thank for reply but there is no closing properties for that menulist..
Thank for reply but there is no closing properties for that menulist..
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank for trying no solution, so I took other way, but grateful for your response.
ASKER
R.