0

実行時に、画像ボックスに多くの画像を追加する必要があります。多くの画像があり、picture1.line で接続したいと考えています。しかし、開始点から終了点までの実際の座標を(実行時に)知る必要があります。

マウスポインタの座標を読み取り/表示する方法についての例やアイデアはありますか?

4

1 に答える 1

1

In VB6 you can do it this way. Create a new form and add the following code:

Option Explicit

Private Type POINTAPI 'Type to hold coordinates
    X As Long
    Y As Long
End Type

'Function that gets current position
Private Declare Sub GetCursorPos Lib "User32" (lpPoint As POINTAPI)

'On mouse move, update form
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim rect As POINTAPI

    'Get position
    GetCursorPos rect

    'Print coordinates
    Me.Cls
    Print "Current X = " & rect.X
    Print "Current Y = " & rect.Y
End Sub
于 2013-07-18T07:39:10.237 に答える