screen对象取得屏幕的中心位置,其他的就想上边那个说的一样了

解决方案 »

  1.   

    private sub mouse_move()
    const pi as double=3.14
    dim angle as double
    angle=atn((y-me.height/2)/(x-me.width/2))
    if y>me.height/2 then 
       text1.text=angle + pi
    else
       text1.text=angle
    end if
      

  2.   

    我写的反正切函数:Public Const Pi As Double = 3.14159265358979Public Function ArcTan(Y As Double, X As Double) As Double
        Dim t As Double
        
        If X = 0 Then
            If Y > 0 Then
                ArcTan = Pi / 2
            ElseIf Y = 0 Then
                ArcTan = 0
            Else
                ArcTan = Pi * 3 / 2
            End If
        Else
            t = Atn(Y / X)
            If X < 0 Then t = t + Pi
            If X > 0 And Y < 0 Then t = t + Pi * 2
            ArcTan = t
        End If
        
    End Function返回值的单位是弧度
      

  3.   

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim C As IntegerOn Error Resume Next
    C = Atn(-Y / X) / 3.14159 * 180
    If C < 0 Then
        C = C + 180
    End If
    If Y > 0 Then
        C = C + 180
    End If
    Me.Caption = C
    If Err.Number <> 0 Then
      If X = 0 Then
        Me.Caption = ""
      ElseIf X > 0 Then
        Me.Caption = 180
      Else
        Me.Caption = -180
      End If
    End If
    End SubPrivate Sub form_resize()
    On Error Resume Next
    Me.Scale (-Me.ScaleWidth / 2, -Me.ScaleHeight / 2)-(Me.ScaleWidth / 2, Me.ScaleHeight / 2)
    End Sub
      

  4.   

    我希望知道鼠标所在的角度, IsMe给出的结果最和要求,散分,如果因为水平所限制分的不好,请见量