Domanda

When i select any option from the drop-down of the Menu-strip control, the Code in its Click event is fired and the drop-down collapses. But i want that drop-down must stay open.

Please help

If i open a dialog on click of the item in this menu, the opened menu always remain in front of the dialog. How to send it to back?

È stato utile?

Soluzione

if the Reception is of type ToolStripMenuItem you can just do this :

Reception.DropDown.AutoClose = false;

You need to do that for Lab, Admin .. if you want the same effect for them.

PS : The Menu would stay open even if it loses focus. so you need to close it manually/programatically.

Alternatively (Which I think is more efficient), handle the closing event for the dropdown and cancel the closing if the CloseReason is ItemClicked.

Reception.DropDown.Closing += new ToolStripDropDownClosingEventHandler(DropDown_Closing);

private void DropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
    {
        if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked || e.CloseReason == ToolStripDropDownCloseReason.AppFocusChange)
           e.Cancel = true;
    }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top