📄 frmmaincode.frm
字号:
VERSION 5.00
Begin VB.Form frmMainCode
BorderStyle = 0 'None
Caption = "Skin Form with Menu"
ClientHeight = 3855
ClientLeft = 0
ClientTop = 0
ClientWidth = 6660
Icon = "frmMainCode.frx":0000
LinkTopic = "Form1"
ScaleHeight = 257
ScaleMode = 3 'Pixel
ScaleWidth = 444
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "隧洞参数"
Height = 2532
Left = 240
TabIndex = 13
Top = 600
Width = 3135
Begin VB.TextBox Textb
Appearance = 0 'Flat
Height = 288
Left = 960
TabIndex = 16
Top = 480
Width = 1452
End
Begin VB.TextBox Texth
Appearance = 0 'Flat
Height = 288
Left = 960
TabIndex = 15
Top = 1080
Width = 1452
End
Begin VB.TextBox Texta
Appearance = 0 'Flat
Height = 288
Left = 1200
TabIndex = 14
Top = 1800
Width = 1212
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "宽度b:"
Height = 255
Left = 120
TabIndex = 22
Top = 480
Width = 735
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "直墙高h:"
Height = 255
Left = 120
TabIndex = 21
Top = 1080
Width = 975
End
Begin VB.Label Label3
BackColor = &H00C0C0C0&
Caption = "顶拱中心角:"
Height = 255
Left = 120
TabIndex = 20
Top = 1800
Width = 1215
End
Begin VB.Label Label6
BackColor = &H00C0C0C0&
Caption = "米"
Height = 252
Left = 2420
TabIndex = 19
Top = 500
Width = 252
End
Begin VB.Label Label7
BackColor = &H00C0C0C0&
Caption = "米"
Height = 252
Left = 2420
TabIndex = 18
Top = 1100
Width = 252
End
Begin VB.Label Label8
BackColor = &H00C0C0C0&
Caption = "度"
Height = 252
Left = 2420
TabIndex = 17
Top = 1820
Width = 252
End
End
Begin VB.Frame Frame2
BackColor = &H00C0C0C0&
Caption = "迭代计算"
Height = 2532
Left = 3480
TabIndex = 4
Top = 600
Width = 2895
Begin VB.TextBox TextQ
Appearance = 0 'Flat
Height = 288
Left = 720
TabIndex = 7
Top = 480
Width = 1212
End
Begin VB.TextBox TextHk
Appearance = 0 'Flat
BackColor = &H80000001&
ForeColor = &H80000005&
Height = 288
Left = 240
Locked = -1 'True
TabIndex = 6
Top = 1920
Width = 1932
End
Begin VB.TextBox TextWC
Appearance = 0 'Flat
Height = 288
Left = 720
TabIndex = 5
Text = "0.001"
Top = 1080
Width = 1212
End
Begin VB.Label Label4
BackColor = &H00C0C0C0&
Caption = "流量Q:"
Height = 255
Left = 120
TabIndex = 12
Top = 480
Width = 855
End
Begin VB.Label Label5
BackColor = &H00C0C0C0&
Caption = "临界水深Hk:"
Height = 255
Left = 120
TabIndex = 11
Top = 1560
Width = 1455
End
Begin VB.Label Label9
BackColor = &H00C0C0C0&
Caption = "米3/秒"
Height = 255
Left = 1935
TabIndex = 10
Top = 495
Width = 570
End
Begin VB.Label Label10
BackColor = &H00C0C0C0&
Caption = "米"
Height = 255
Left = 2280
TabIndex = 9
Top = 1920
Width = 255
End
Begin VB.Label Label11
BackColor = &H00C0C0C0&
Caption = "误差:"
Height = 255
Left = 120
TabIndex = 8
Top = 1080
Width = 735
End
End
Begin VB.CommandButton Command1
Caption = "开始计算"
Default = -1 'True
Height = 372
Left = 1920
TabIndex = 3
Top = 3360
Width = 972
End
Begin VB.CommandButton Command2
Caption = "清空数据"
Height = 372
Left = 2880
TabIndex = 2
Top = 3360
Width = 972
End
Begin VB.CommandButton Command3
Cancel = -1 'True
Caption = "退出程序"
Height = 372
Left = 3840
TabIndex = 1
Top = 3360
Width = 972
End
Begin VB.Label lblTitle
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "门洞型隧洞临界水深计算 BY 飘叶它乡 QQ:51817"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 240
Left = 120
TabIndex = 0
Top = 0
Width = 5145
End
Begin VB.Image imgTitleMaxRestore
Height = 195
Left = 4680
ToolTipText = "Maximize (Disabled)"
Top = 0
Width = 195
End
Begin VB.Image imgTitleRestore
Height = 195
Left = 6360
Picture = "frmMainCode.frx":08CA
ToolTipText = "Maximize (Disabled)"
Top = 960
Visible = 0 'False
Width = 195
End
Begin VB.Image imgTitleMaximize
Height = 195
Left = 6360
Picture = "frmMainCode.frx":0B14
ToolTipText = "Maximize (Disabled)"
Top = 720
Visible = 0 'False
Width = 195
End
Begin VB.Image imgTitleMinimize
Height = 195
Left = 6360
Picture = "frmMainCode.frx":0D5E
ToolTipText = "Minimize"
Top = 480
Width = 195
End
Begin VB.Image imgTitleClose
Height = 195
Left = 6360
Picture = "frmMainCode.frx":0FA8
ToolTipText = "Close"
Top = 240
Width = 195
End
Begin VB.Image imgTitleHelp
Height = 195
Left = 6360
Picture = "frmMainCode.frx":11F2
ToolTipText = "Help"
Top = 0
Width = 195
End
Begin VB.Image imgWindowBottomLeft
Height = 450
Left = 5640
Picture = "frmMainCode.frx":143C
Top = 0
Width = 285
End
Begin VB.Image imgWindowBottom
Height = 450
Left = 5280
Picture = "frmMainCode.frx":1B86
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowLeft
Height = 450
Left = 5640
Picture = "frmMainCode.frx":22D0
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowRight
Height = 450
Left = 6000
Picture = "frmMainCode.frx":2A1A
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgTitleLeft
Height = 450
Left = 4920
Picture = "frmMainCode.frx":3164
Top = 0
Width = 285
End
Begin VB.Image imgTitleRight
Height = 450
Left = 5280
Picture = "frmMainCode.frx":38AE
Top = 0
Width = 285
End
Begin VB.Image imgTitleMain
Height = 450
Left = 4920
Picture = "frmMainCode.frx":3FF8
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowBottomRight
Height = 450
Left = 6000
Picture = "frmMainCode.frx":4742
Top = 0
Width = 285
End
End
Attribute VB_Name = "frmMainCode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public WC As Single
Const PI = 3.1415926
Function JS(ByVal b As Single, ByVal h As Single, ByVal a As Single, ByVal Q As Single) As Single
Dim h1, a1, r, W, W1, HK, Hk0 As Single
HK = ((Q / b) ^ 2 * 1.05 / 9.8) ^ (1 / 3)
If HK <= h And HK > 0 Then
JS = HK
TextHk.Text = CStr(JS)
Else
r = (b / 2) / Sin(a * PI / 360) '顶拱半径
h1 = h + r * (1 - Cos(a * PI / 360)) '隧洞高度
Hk0 = (h1 + h) / 2 '初始临界水深
W = b * h + a * PI * r ^ 2 / 360 - r ^ 2 * Sin(a * PI / 180) / 2 '隧洞面积
W1 = W - 0.5 * PI * r * (h1 - Hk0) '过水面积
HK = (1.05 * Q ^ 2 / 9.8) / (W1 ^ 2) '迭代公式
If HK - Hk0 <= WC Then
JS = HK
TextHk.Text = CStr(JS)
End If
Do While (HK - Hk0 > WC)
Hk0 = (Hk0 + HK) / 2
If Hk0 >= h1 Then
TextHk.ForeColor = vbYellow
TextHk.Text = "隧洞被水充满,无法计算临界水深!"
Exit Do
End If
W1 = W - 2 * PI * r * (h1 - Hk0) '过水面积
HK = (1.05 * Q ^ 2 / 9.8) / W1 ^ 2 '迭代公式
If HK - Hk0 <= WC Then
JS = HK
TextHk.Text = CStr(JS)
Exit Do
End If
Loop
End If
End Function
Private Sub Command1_Click()
TextHk.Text = ""
If Textb.Text = "" Or Texth.Text = "" Or Texta.Text = "" Or TextQ.Text = "" Or TextWC.Text = "" Then
TextHk.ForeColor = vbYellow
TextHk.Text = "请输入必需的参数!"
Exit Sub
Else
b = Val(Textb.Text)
h = Val(Texth.Text)
a = Val(Texta.Text)
Q = Val(TextQ.Text)
WC = Val(TextWC.Text)
End If
Call JS(b, h, a, Q)
End Sub
Private Sub Command2_Click()
Textb.Text = ""
Texth.Text = ""
Texta.Text = ""
TextQ.Text = ""
TextHk.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
Dim b, h, h1, a, a1, Q As Single
MakeWindow Me, False
imgTitleMaxRestore.Picture = imgTitleMaximize.Picture
LoadSkinz Me
End Sub
Private Sub imgTitleClose_Click()
Unload Me
End Sub
Private Sub imgTitleLeft_MouseDown(p_intButton As Integer, p_intShift As Integer, p_sngX As Single, p_sngY As Single)
DoDrag Me
End Sub
Private Sub imgTitleMain_MouseDown(p_intButton As Integer, p_intShift As Integer, p_sngX As Single, p_sngY As Single)
DoDrag Me
End Sub
Private Sub imgTitleMinimize_Click()
Me.WindowState = vbMinimized
End Sub
Private Sub imgTitleRight_MouseDown(p_intButton As Integer, p_intShift As Integer, p_sngX As Single, p_sngY As Single)
DoDrag Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -