开始 输入XY的坐标 判断X坐标是否相等 相等 不相 等 通过比较△X与△Y的大小来确定所在象限及计算方位角,及观测距离 计算△Y并确的方位角 输出方位角及观测距离 结束
Private Sub Command1_Click()
Const pi As Double = 3.141592653579
Dim i As Double, a As Long, b As Long, c As Long, w As Double, n As String
Dim x!, y!, d!
x = Str(Val(Text2) - Val(Text1)) y = Str(Val(Text4) - Val(Text3)) d = (x ^ 2 + y ^ 2) ^ 0.5 Text6 = Format(d, \"0.00\")
If x = 0 Then '当x=0时程序至于这 a = 90 b = 270 c = 0
Text6 = Format(y, \"0.00\")
If y > 0 Then ss = a & \"°\" & c & \"′\" & c & \"″\" Text5 = Format(ss)
If y < 0 Then ss = b & \"°\" & c & \"′\" & c & \"″\" Text5 = Format(ss) End If
If x <> 0 Then '当x≠0时程序继续
i = Atn(y / x) w = i * 180 / pi
If x < 0 And y < 0 Then '根据xy的大小于求所在象限 算方位角 n = w + 180
ElseIf x < 0 And y > 0 Then n = 180 - w ElseIf x > 0 And y < 0 Then n = 360 - w ElseIf x > 0 And y > 0 Then n = w ElseIf x > 0 And y = 0 Then n = 0 ElseIf x < 0 And y = 0 Then n = 180 End If
a = Int(n): n = (n - a) * 60 'int(n)是取小于等于n的最大整数 b = Int(n): n = (n - b) * 60
c = Round(n) '四舍五入取整 If c = 60 Then c = 0: b = b + 1 If b = 60 Then b = 0: a = a + 1
ss = a & \"°\" & b & \"′\" & c & \"″\" Text5 = Format(ss)
End If ' End Sub
Private Sub Command2_Click() Text1 = \"\" Text2 = \"\" Text3 = \"\" Text4 = \"\" Text5 = \"\" Text6 = \"\" End Sub
Private Sub Command3_Click() End End Sub
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- jqkq.cn 版权所有 赣ICP备2024042794号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务