解决了马上给分

解决方案 »

  1.   

    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        MsgBox "怎么动鼠标了?X=" & X & ",Y=" & Y, vbQuestion + vbOKOnly
    End Sub
      

  2.   

    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = 1 Then MsgBox "您单击了鼠标左键" & vbCrLf & " X=" & X & ",Y=" & Y
        If Button = 2 Then MsgBox "您单击了鼠标右键" & vbCrLf & " X=" & X & ",Y=" & Y
    End Sub
      

  3.   

    用鼠标单击事件(MouseDown事件)。
    具体代码用northwolves(野性的呼唤)的。
      

  4.   

    用VB就是楼上几位说的,亦可WM_LBUTTONDOWN、WM_LBUTTONUP消息
      

  5.   

    Type POINTAPI
        x As Long
        y As Long
    End Type
    Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Public Const HWND_TOPMOST = -1
    Public Const SWP_NOMOVE = &H2
    Public Const SWP_NOSIZE = &H1
    Public Const SWP_NOZORDER = &H8Public Sub SetFormTopmost(TheForm As Form)
    SetWindowPos TheForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
    SWP_NOZORDER + SWP_NOMOVE + SWP_NOSIZE
    End Sub
    Dim z As POINTAPI
    Public fx
    Public fy
    Public a
    Private Sub Form_Load()
    Form1.Left = 200
    Form1.Top = 200
    fx = 1
    fy = 1
    a = 1
    End SubPrivate Sub Timer1_Timer()
    GetCursorPos z
    If Form1.Left < z.x * 200 / 13 Then
        fx = 1
    End If
    If Form1.Top < z.y * 200 / 13 Then
        fy = 1
    End If
    If Form1.Left > z.x * 200 / 13 Then
        fx = -1
    End If
    If Form1.Top > z.y * 200 / 13 Then
        fy = -1
    End If
    If fx = 1 Then
        Form1.Left = Form1.Left + 50
    End If
    If fy = 1 Then
        Form1.Top = Form1.Top + 50
    End If
    If fx = -1 Then
        Form1.Left = Form1.Left - 50
    End If
    If fy = -1 Then
        Form1.Top = Form1.Top - 50
    End If
    If z.x * 200 / 13 > Form1.Left And z.x * 200 / 13 < Form1.Left + 480 Then
        If z.y * 200 / 13 > Form1.Top And z.y * 200 / 13 < Form1.Top + 495 Then
            Timer1.Enabled = False
               SetFormTopmost Form1
      
            v = MsgBox("你一百分是我的了", vbOKOnly, "结帐吧")
            If v = vbOK Then
                End
            End If
        End If
    End If
    End Sub