Article | 41024121 |
Type | HowTo |
Product | Engine |
Version | 5.1.1.1038 |
Date Added | 10/17/2005 |
Submitted by | Steve Smith |
Keywords |
This can be done only using API calls like:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
You can try a code (move the cursor to a specific x,y coordinates of the VD drawing area) like in VB .NET:
Private Sub movecursor(ByVal x As Double, ByVal y As Double) 'x,y in coordinates Dim aXY As Object Dim ScrPT As Point aXY = AxVDPro1.VdViewToPixel(New Object() {x, y}) 'client ScrPT = AxVDPro1.PointToScreen(New Point(aXY(0), aXY(1))) System.Windows.Forms.Cursor.Position = ScrPT End SubYou can try a code (move the cursor to the center of the VD drawing area) like in VisualBasic 6:
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function GetCursor Lib "user32" () As Long Private Type POINTAPI X As Long Y As Long End Type Private Sub MoveCursorToCenter() Dim FormTop As Long Dim FormLeft As Long Dim vdTop As Long Dim vdLeft As Long Dim VDCenY As Long Dim VDCenX As Long Dim cp As POINTAPI GetCursorPos cp Me.Caption = "x: " & cp.X & " , y: " & cp.Y FormLeft = Form1.Left / Screen.TwipsPerPixelX ' in pixels FormTop = Form1.Top / Screen.TwipsPerPixelY ' in pixels vdTop = VDPro1.Top / Screen.TwipsPerPixelY vdLeft = VDPro1.Left / Screen.TwipsPerPixelX VDCenX = CLng((VDPro1.ActiveDocument.ViewSize / 2#) / VDPro1.ActiveDocument.PixelSize) VDCenY = CLng((VDPro1.ActiveDocument.ViewWidth / 2#) / VDPro1.ActiveDocument.PixelSize) SetCursorPos FormLeft + vdLeft + 3 + VDCenY, FormTop + vdTop + 23 + VDCenX GetCursorPos cp Me.Caption = "x: " & cp.X & " , y: " & cp.Y End Sub