坐标正反算vb测量程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
坐标正反算vb测量程序
河北工程大学测绘1001 刘长君
以下是登陆界面和计算界面的截图:
以下就是对应的代码:
《登陆界面的代码》
Private Sub Command1_Click()
If = "刘长君" And = "0" Then
Unload Me
Else
Dim a As Integer
a = MsgBox("密码输入有误,请重新输入", 1, "提示框")
If a = 1 Then
= ""
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
《计算界面的代码》
Private Sub Command1_Click(Index As Integer)
Dim a1%, a2%, a3%, a4!, a5!, pi!
Const conpi =
If IsNumeric(Text1(1)) = False Or IsNumeric(Text2(2)) = False Or IsNumeric(Text3(3)) = False Or IsNumeric(Text4(4)) = False Or IsNumeric(Text5(5)) = False Or IsNumeric(Text6(6)) = False Then
MsgBox "输入有误"
Text1(1).SetFocus
Else
If Val(Trim(Text5(5).Text)) > 60 Or Val(Trim(Text5(5).Text)) < 0 Or Val(Trim(Text6(6).Text)) > 60 Or Val(Trim(Text6(6).Text)) < 0 Then MsgBox "方位角输入有误,请重新输入"
Text4(4).SetFocus
Text4(4).Text = ""
Text5(5).Text = ""
Text6(6).Text = ""
End If
a1 = Val(Text4(4).Text)
a2 = Val(Text5(5).Text)
a3 = Val(Text6(6).Text)
a4 = a1 + a2 / 60 + a3 / 3600
a5 = a4 * conpi / 180
= Val(Text3(3).Text) * Cos(a5)
= Val(Text3(3).Text) * Sin(a5)
= Val(Text1(1).Text) + Val
= Val(Text2(2).Text) + Val
= Format((Val * 10000 + / 10000, "####.0000")
= Format((Val * 10000 + / 10000, "####.0000")
= Format((Val * 10000 + / 10000, "####.0000")
= Format((Val * 10000 + / 10000, "####.0000")
End If
End Sub
Private Sub Command2_Click(Index As Integer)
Text1(1).Text = " "
Text2(2).Text = " "
Text3(3).Text = " "
Text4(4).Text = " "
Text5(5).Text = " "
Text6(6).Text = " "
= ""
= ""
= ""
= ""
Text1(1).SetFocus
End Sub
Private Sub Command3_Click()
Dim dx!, dy!, a12!, r12!, d12!
Const conpi =
If IsNumeric(Text7) = False Or IsNumeric(Text8) = False Or IsNumeric(Text9) = False Or IsNumeric(Text10) = False Then
MsgBox "输入有误"
Else
dx = Val - Val
dy = Val - Val
d12 = Sqr(dx ^ 2 + dy ^ 2)
= Format((d12 * 10000 + / 10000, "####.0000")
If dx = 0 And dy > 0 Then
= 90: = 0: = 0
ElseIf dx = 0 And dy < 0 Then
= 270: = 0: = 0
Else
r12 = Atn(Abs(dy / dx))
If dx > 0 And dy > 0 Then
a12 = r12
ElseIf dx < 0 And dy > 0 Then
a12 = pi - r12
ElseIf dx < 0 And dy < 0 Then
a12 = pi + r12
ElseIf dx > 0 And dy < 0 Then
a12 = 2 * pi - r12
End If
a12 = a12 / conpi * 180
= Fix(a12)
= Abs(Fix((a12 - Fix(a12)) * 60))
= Abs(Fix((((a12 - Fix(a12)) * 60) - Fix((a12 - Fix(a12)) * 60)) * 60))