Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do not close ToolStripMenu on clicking in winforms

I work on a c# winform project that the main toolstripmenu have not to be hide after user clicks on its item, how can I do that?

enter image description here

like image 763
ArMaN Avatar asked Nov 15 '25 22:11

ArMaN


1 Answers

I found better answer on MSDN forum. Dropdown doesn't close on click, but closes in other cases:

DropDown.Closing += new ToolStripDropDownClosingEventHandler(DropDown_Closing);
...
private void DropDown_Closing(object sender,  ToolStripDropDownClosingEventArgs e)
{
    if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
    {
        e.Cancel = true;
    }
}
like image 113
maxc137 Avatar answered Nov 17 '25 21:11

maxc137



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!