Software Development Network>> Visual C#>> How can I show a contextMenuStrip when a user right click a mainMenuStrip item?
How can I show a contextMenuStrip when a user right click a mainMenuStrip item?
SnakeSV
As far as what you are doing....do this:
pass in the control or button control that you want the context menu to associate to, and a point.
So:
// Point where the mouse is clicked.
Point p = new Point(e.X, e.Y);
this.myDesignTimeCreatedContextMenuStrip.Show(the toolbar control object, p);
belisa
this.ExampleBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ExampleBtn_MouseUp);
Then what you are going to do is check what button was clicked.
private void ExampleBtn_MouseUp(object sender, MouseEventArgs e)
{
{
Hope this points you in the right direction.
JayR
I used your code and I changeed:
create context menu...bla bla bla.
To:
myDesignTimeCreatedContextMenuStrip.Show(new Point(Cursor.Position.X, Cursor.Position.Y));
The problem is when I right click on a menu item the main menu (Favorites) is being closed as soon as the context menu is shown.
How can I fix that