|
|
Title | Give a form a popup menu |
Keywords | popup menu, context menu, right click |
Categories | Controls, Tips and Tricks |
|
|
In the menu editor, create a menu named mnuPopup. Set its Visible property to False and give it the menu items you want to display on the popup.
In the form's MouseDown event handler, look for the right mouse button. When you see it, use the PopupMenu command to display the popup menu.
|
|
' On right click, display the popup.
Private Sub Form_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
If Button = vbRightButton Then
PopupMenu mnuPopup
End If
End Sub
|
|
|
|
|
|