马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
当需要用户按右键指定缺省角度(Degree类型)时,可以用下面的函数。
- [FONT=courier new]
- '输入角度
- Pt 给定点
- Prompt 提示信息
- defDeg 缺省角度,不是弧度
- Public Function GetAngle(Optional ByVal Pt As Variant, Optional ByVal Prompt As String, Optional ByVal defDeg As Double) As Double
- If defDeg <> 0 Then GetAngle = ThisDrawing.Utility.AngleToReal(CStr(defDeg), acDegrees)
-
- On Error GoTo ErrTrap
- If Prompt = "" Then Exit Function
- If Not IsMissing(Pt) Then
- GetAngle = ThisDrawing.Utility.GetAngle(Pt, Prompt)
- Else
- GetAngle = ThisDrawing.Utility.GetAngle(, Prompt)
- End If
- Exit Function
-
- ErrTrap:
- Debug.Print "GetAngle: " & Err.Number & ", " & Err.Description
- On Error GoTo 0
- End Function
- [/FONT]
- [FONT=courier new]
- Sub Test()
- Dim Ang As Double
- Ang = GetAngle(, "请输入角度<" & 45 & ">", 45)
- Debug.Print Ang
- End Sub
- 当指定角度时,得到45°的弧度值0.785398163397448 。
- [/FONT]
|