0

I am trying to create my own menu (and practice a little c#) and I am almost done. I have the menu and the context menu that will be shown created. I also have the context menu showing at the correct time.
My problem comes when the menu disappears when you try to move your mouse over it. Only about 75% of the time though. The code below is the only spot where the context menu is hidden. I have uploaded the full project here.

private void this_MouseEnter(object sender, EventArgs e)
{
     System.Diagnostics.Debug.WriteLine("Enter");
     isOverContextMenu = true;
}
		
private void this_MouseLeave(object sender, EventArgs e)
{
     if(myState == "show" && !isOverContextMenuItem)
     {
          System.Diagnostics.Debug.WriteLine("Exit");
          isOverContextMenu = false;
          HIDE();
     }
}

Edited by skybomb0: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by skybomb0
0

Handle the MouseLeave event of ContentMenuStrip.

private void contextMenuStrip1_MouseLeave(object sender, EventArgs e)
{
   contextMenuStrip1.Hide();
}
0

I don't have a contextMenuStrip1 variable so I'm not sure exactly what object you are referring to, but have managed to get most of the closing to work. The only problem I am having now is after you click on the menu item, move your mouse over the menu, and then move the mouse back over the menu item you clicked, the context menu should stay open. How would I go about this?

I have updated my project at the above link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.