|
-
Nov 6th, 2000, 09:32 PM
#1
Thread Starter
PowerPoster
I just write the following code in the Treeview_MouseDown event:
Code:
Dim Px As Long
Dim Py As Long
If Button = vbRightButton Then
GetCursorPos pt
Px = ScaleX(pt.x, vbPixels, vbTwips)
Py = ScaleY(pt.y, vbPixels, vbTwips) - 250
PopupMenu mnuOPTION, vbPopupMenuLeftAlign, Px, Py
End If
When my form in Maximized mode, everything is fine, PopUpmenu just beside my mouse pointer. But if I resize my form then the problem come out and I can not set the PopUpmenu right beside my mouse pointer.
It is something wrong with my code? Does anyone have a better solution for the PopUpMenu?
Thanks,
Chris.C
-
Nov 6th, 2000, 11:03 PM
#2
Addicted Member
If you want the popup right beside the mouse, just use
Code:
' Creates a popup at the current cursor co-ords.
me.popupmenu mnuOPTIONS
You only need to specify more if you don't want to have the popup at the current location.
If you really want to specialize
Code:
Dim Px As Long
Dim Py As Long
If Button = vbRightButton Then
GetCursorPos pt
Px = ScaleX(pt.x, vbPixels, vbTwips)
Py = ScaleY(pt.y, vbPixels, vbTwips) - 250
Px = Px + Me.Left
Py = Py + Me.Top
PopupMenu mnuOPTION, 2, Px, Py
End If
Brian
Programming: VB5 Pro (SP3) - QBasic 1.1,4.5
Internet: HTML 4, CSS, JavaScript
Visit AltInt.com!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|