Skip to main content

How to: Display a Popup Menu

The following code displays a specific PopupMenu if the right mouse button is pressed:

private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) {
    if(e.Button == MouseButtons.Right)
        popupMenu1.ShowPopup(Control.MousePosition);
}