|
SmartMenuXP
Reference
Shows a menu at a specific position on screen. The SmartMenuXP control has to
be invisible in order to use this method.
Syntax
object.PopupMenu (ID, X , Y, Flags)
The PopupMenu method syntax
has these parts:
| Part |
Description |
| object |
An object expression that evaluates to a SmartMenuXP object. |
| ID |
A numeric value that evaluates to a menu item. |
| X |
A numeric value that evaluates to a screen X-point expressed
in pixels. |
| Y |
A numeric value that evaluates to a screen Y-point expressed
in pixels. |
| Flags |
A numeric value that will determine the position where the
menu will popup as described in settings. |
Settings
You can add more than one flag by using the operand OR. Use
one of the following flags to specify how the function positions the shortcut
menu horizontally:
| Setting |
Description |
| &H0 |
The function positions the menu so that its left side is
aligned with the coordinate specified by the x parameter. |
| &H4 |
The function centers the menu horizontally relative to the
coordinate specified by the x parameter. |
| &H8 |
Positions the menu so that its right side is aligned with
the coordinate specified by the x parameter. |
Use one of the following flags to specify how
the function positions the shortcut menu vertically:
| Setting |
Description |
| &H0 |
The function positions the menu so that its top side is
aligned with the coordinate specified by the y parameter. |
| &H10 |
The function centers the menu vertically relative to the
coordinate specified by the y parameter. |
| &H20 |
The function positions the menu so that its bottom side is
aligned with the coordinate specified by the y parameter. |
Remarks
This function is useful when it is used in conjunction with ClientToScreentX and
ClientToScreenY.
Private Sub
Form_MouseDown( _
Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)
If Button <> vbRightButton
Then Exit Sub
With SmartMenuXP1
X = .ClientToScreenX(Me.hWnd, X)
Y = .ClientToScreenY(Me.hWnd, Y)
.PopupMenu
.MenuItems.Key2ID("kMenu"), X, Y, 0
End With
End Sub
|