adding right-click popup menu to windows form

  • Thread starter Thread starter VM
  • Start date Start date
V

VM

How can I display my own popup menu when a user right-clicks inside the
form? I know you use context menus but I don't how to implement them.

Thanks.
 
Hi VM,

VM said:
How can I display my own popup menu when a user right-clicks inside the
form? I know you use context menus but I don't how to implement them.

Thanks.

Drop a ContextMenu component onto the form designer from the toolbox.
Create an event handler for the MouseDown event of the form. Put code in the
MouseDown event handler that looks like this (this code assumes the
ContextMenu component is named mnuContext):

if (e.Button == MouseButtons.Right)
mnuContext.Show(this, new Point(e.X, e.Y));


Regards,
Daniel
 
drag a context menu control onto the form and fill in what you want. Then
go to the control in question and there will now be a ContextMenu property,
click on it and add your menu.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top