Public x_dadi_o As Double, y_dadi_o As Double, x_daba_o As Double, y_daba_o As Double, j_fangweijiao As DoublePublic x_dadi_p As Double, y_dadi_p As Double, x_daba_p As Double, y_daba_p As DoublePrivate Sub Command1_Click()
Public x_dadi_o As Double, y_dadi_o As Double, x_daba_o As Double, y_daba_o As Double, j_fangweijiao As Double
Public x_dadi_p As Double, y_dadi_p As Double, x_daba_p As Double, y_daba_p As Double
Private Sub Command1_Click()
Call annony_
End Sub
Private Sub Command2_Click()
Text6.Text = ""
Text7.Text = "": Text8.Text = "": Text9.Text = "": Option1.Value = False: Option2.Value = False
Exit Sub
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
If (Text1.Text = "" Or Text2.Text = "") Or (Text3.Text = "" Or Text4.Text = "") Or (Text5.Text = "" And Text10.Text = "" And Text11.Text = "" And Text12.Text = "") Then
MsgBox "请输入基本参数!", vbOKOnly, "提示"
Exit Sub
End If
x_dadi_o = Val(Text1.Text): y_dadi_o = Val(Text2.Text): x_daba_o = Val(Text3.Text): y_daba_o = Val(Text4.Text)
If Text5.Text = "" Then
j_fangweijiao = (Val(Text10.Text) + Val(Text11.Text) / 60 + Val(Text12.Text) / 3600) * 3.1415926 / 180
Else
j_fangweijiao = Val(Text5.Text) * 3.1415926 / 180
End If
If (Option1.Value = False And Option2.Value = False) Then
MsgBox "请选择计算类型!", vbOKOnly, "提示"
Exit Sub
End If
End Sub
Private Sub Command5_Click()
Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = "": Text5.Text = "": Text10.Text = "": Text11.Text = "": Text12.Text = ""
End Sub
Private Sub Option1_Click()
If Option1.Value = True Then
Text6.Text = "": Text7.Text = "": Text8.Text = "": Text9.Text = ""
Text6.SetFocus
End If
End Sub
Private Sub Option2_Click()
If Option2.Value = True Then
Text6.Text = "": Text7.Text = "": Text8.Text = "": Text9.Text = ""
End If
Text8.SetFocus
End Sub
Sub annony_()
If (Option1.Value = False And Option2.Value = False) Then
MsgBox "请选择计算类型!", vbOKOnly, "提示"
Exit Sub
End If
If Option2.Value = True Then
If (Text8.Text = "" And Text9.Text = "") Then
MsgBox "请输入已知点P的大坝坐标值!", vbOKOnly, "提示"
Exit Sub
End If
x_daba_p = Val(Text8.Text): y_daba_p = Val(Text9.Text)
dx = x_daba_p - x_daba_o
dy = y_daba_p - y_daba_o
x_dadi_p = x_dadi_o + dx * Cos(j_fangweijiao) - dy * Sin(j_fangweijiao)
y_dadi_p = y_dadi_o + dx * Sin(j_fangweijiao) + dy * Cos(j_fangweijiao)
Text6.Text = Str(Int(x_dadi_p * 1000) * 0.001)
Text7.Text = Str(Int(y_dadi_p * 1000) * 0.001)
ElseIf Option1.Value = True Then
If (Text6.Text = "" And Text7.Text = "") Then
MsgBox "请输入已知点P的大地坐标值!", vbOKOnly, "提示"
Exit Sub
End If
x_dadi_p = Val(Text6.Text): y_dadi_p = Val(Text7.Text)
dx = x_dadi_p - x_dadi_o
dy = y_dadi_p - y_dadi_o
x_daba_p = x_daba_o + dx * Cos(j_fangweijiao) + dy * Sin(j_fangweijiao)
y_daba_p = y_daba_o - dx * Sin(j_fangweijiao) + dy * Cos(j_fangweijiao)
Text8.Text = Str(Int(x_daba_p * 1000) * 0.001)
Text9.Text = Str(Int(y_daba_p * 1000) * 0.001)
End If
End Sub