📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8220
ClientLeft = 60
ClientTop = 450
ClientWidth = 13830
LinkTopic = "Form1"
ScaleHeight = 8220
ScaleWidth = 13830
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame3
Caption = "中间变量"
Height = 2055
Left = 0
TabIndex = 17
Top = 4320
Width = 12975
Begin VB.TextBox Text7
Height = 375
Index = 0
Left = 1320
TabIndex = 25
Top = 1440
Width = 1095
End
Begin VB.TextBox Text6
Height = 375
Index = 0
Left = 1320
TabIndex = 24
Top = 1080
Width = 1095
End
Begin VB.TextBox Text5
Height = 375
Index = 0
Left = 1320
TabIndex = 23
Top = 600
Width = 1095
End
Begin VB.TextBox Text4
Height = 375
Index = 0
Left = 1320
TabIndex = 22
Top = 240
Width = 1095
End
Begin VB.Label Label15
Caption = "各v(i)值:"
Height = 375
Left = 360
TabIndex = 21
Top = 1560
Width = 975
End
Begin VB.Label Label14
Caption = "各p(i)值:"
Height = 495
Left = 360
TabIndex = 20
Top = 1200
Width = 975
End
Begin VB.Label Label13
Caption = "各s(i)值:"
Height = 375
Left = 360
TabIndex = 19
Top = 720
Width = 975
End
Begin VB.Label Label12
Caption = "各h(i)值:"
Height = 255
Left = 360
TabIndex = 18
Top = 360
Width = 975
End
End
Begin VB.Frame Frame2
Caption = "计算结果"
Height = 1935
Left = 0
TabIndex = 7
Top = 6480
Width = 12975
Begin VB.TextBox Text14
Height = 495
Left = 10680
TabIndex = 32
Top = 360
Width = 1455
End
Begin VB.TextBox Text13
Height = 375
Left = 6120
TabIndex = 31
Top = 1320
Width = 1575
End
Begin VB.TextBox Text12
Height = 375
Left = 6120
TabIndex = 30
Top = 840
Width = 1575
End
Begin VB.TextBox Text11
Height = 495
Left = 6120
TabIndex = 29
Top = 240
Width = 1575
End
Begin VB.TextBox Text10
Height = 375
Left = 1200
TabIndex = 28
Top = 1320
Width = 1695
End
Begin VB.TextBox Text9
Height = 375
Left = 1200
TabIndex = 27
Top = 840
Width = 1695
End
Begin VB.TextBox Text8
Height = 495
Left = 1200
TabIndex = 26
Top = 240
Width = 1695
End
Begin VB.Label Label10
Caption = "u(1km)="
Height = 375
Left = 9960
TabIndex = 14
Top = 480
Width = 855
End
Begin VB.Label Label9
Caption = "H="
Height = 375
Left = 5760
TabIndex = 13
Top = 480
Width = 615
End
Begin VB.Label Label8
Caption = "u="
Height = 375
Left = 5760
TabIndex = 12
Top = 1440
Width = 495
End
Begin VB.Label Label7
Caption = "[P]="
Height = 495
Left = 360
TabIndex = 11
Top = 1440
Width = 615
End
Begin VB.Label Label6
Caption = "Mx="
Height = 495
Left = 5760
TabIndex = 10
Top = 960
Width = 735
End
Begin VB.Label Label5
Caption = "[pvv]="
Height = 375
Left = 360
TabIndex = 9
Top = 960
Width = 615
End
Begin VB.Label Label3
Caption = "[PH]="
Height = 375
Left = 360
TabIndex = 8
Top = 480
Width = 495
End
End
Begin VB.Frame Frame1
Caption = "请输入"
Height = 3615
Left = 0
TabIndex = 0
Top = 720
Width = 12975
Begin VB.CommandButton Command1
Caption = "计算"
Height = 735
Left = 11760
TabIndex = 16
Top = 2880
Width = 1215
End
Begin VB.TextBox Text3
Height = 735
Index = 0
Left = 2280
TabIndex = 6
Top = 2160
Width = 1335
End
Begin VB.TextBox Text2
Height = 735
Index = 0
Left = 2280
TabIndex = 5
Top = 1320
Width = 1335
End
Begin VB.TextBox Text1
Height = 735
Left = 2280
TabIndex = 4
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "请输入各条路线的距离:"
Height = 495
Left = 120
TabIndex = 3
Top = 2400
Width = 2175
End
Begin VB.Label Label1
Caption = "请输入各条路线的高差值:"
Height = 615
Left = 120
TabIndex = 2
Top = 1440
Width = 2295
End
Begin VB.Label Label4
Caption = "请输入水准路线条数:"
Height = 495
Left = 120
TabIndex = 1
Top = 600
Width = 2535
End
End
Begin VB.Label Label11
Caption = "一个水准点多路线的高程带权平均值解求"
BeginProperty Font
Name = "华文行楷"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 2160
TabIndex = 15
Top = 120
Width = 8895
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim h(), s(), p(), v()
Dim n, i, pp, ph, pvv, m, u, mh
n = Val(Me.Text1.Text)
ReDim h(1 To n)
ReDim s(1 To n)
ReDim p(1 To n)
ReDim v(1 To n)
'填写h矩阵和s矩阵的每一个元素
For i = 0 To n - 1
If Me.Text2(i).Text = "" Then
MsgBox "请输入各条路线的高差值!", "输入高差!"
Text2(k).SetFocus
End If
If Me.Text3(i).Text = "" Then
MsgBox "请输入各条路线的距离!", "输入距离!"
Text3(k).SetFocus
End If
Next i
'给矩阵的每一个元素赋值,并求出p(i),pp,ph
For i = 1 To n
h(i) = Val(Text2(i - 1).Text)
s(i) = Val(Text3(i - 1).Text)
p(i) = 10 / s(i)
pp = pp + p(i)
ph = ph + p(i) * h(i)
Next i
hh = ph / pp
For i = 1 To n
v(i) = (hh - h(i)) * 1000
pvv = pvv + p(i) * v(i) * v(i)
Me.Text4(i - 1).Text = h(i)
Me.Text5(i - 1).Text = s(i)
Me.Text6(i - 1).Text = p(i)
Me.Text7(i - 1).Text = v(i)
Next i
m = Sqr(pvv / (n - 1))
u = m / Sqr(10)
mh = m * Sqr(1 / pp)
Me.Text8.Text = ph
Me.Text9.Text = pvv
Me.Text10.Text = pp
Me.Text11.Text = hh
Me.Text12.Text = mh
Me.Text13.Text = m
Me.Text14.Text = u
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim i, j, k, n As Integer
If KeyAscii = 13 Then
n = Val(Text1.Text)
For i = 1 To n - 1
Load Text2(i)
With Text2(i)
' .Top = Text2(i - 1).Top
.Left = Text2(i - 1).Left + .Width
.Visible = True
End With
Load Text3(i)
With Text3(i)
' .Top = Text2(i - 1).Top
.Left = Text3(i - 1).Left + .Width
.Visible = True
End With
Load Text4(i)
With Text4(i)
' .Top = Text2(i - 1).Top
.Left = Text4(i - 1).Left + .Width
.Visible = True
End With
Load Text5(i)
With Text5(i)
' .Top = Text2(i - 1).Top
.Left = Text5(i - 1).Left + .Width
.Visible = True
End With
Load Text6(i)
With Text6(i)
' .Top = Text2(i - 1).Top
.Left = Text6(i - 1).Left + .Width
.Visible = True
End With
Load Text7(i)
With Text7(i)
' .Top = Text2(i - 1).Top
.Left = Text7(i - 1).Left + .Width
.Visible = True
End With
Next i
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -