Search code examples
c#toolstrip

how to open ToolStripMenuItem Window by moving mouse on ToolStripSplitButton


I have four ToolStripSplitButtons in a ToolStrip in one of my c# applications as shown here.

enter image description here

To open ToolStripMenuItem window I have to click on any of the four ToolStripSplitButtons. As opposed to it I only want to move my mouse(rather than clicking it) on any of the ToolStripSplitButtons and keep it there till ToolStripmenuItems Window appears. I guess I will need a MouseHover event for that but don't know how to do this. I would be thankfull to one who solves this problem.


Solution

  • Something like this:

    public Form1() {
      InitializeComponent();
      toolStripDropDownButton1.MouseEnter += toolStripDropDownButton1_MouseEnter;
    }
    
    void toolStripDropDownButton1_MouseEnter(object sender, EventArgs e) {
      toolStripDropDownButton1.ShowDropDown();
    }
    

    Or you can use the Hover event instead.