📄 常用公式.frm
字号:
Left = 120
TabIndex = 20
Top = 2400
Width = 4455
Begin VB.TextBox Text10
Height = 270
Left = 3000
TabIndex = 24
Text = "Text10"
Top = 360
Width = 1215
End
Begin VB.TextBox Text9
Height = 270
Left = 600
TabIndex = 23
Text = "Text9"
Top = 360
Width = 1215
End
Begin VB.Label Label10
Caption = "Y="
Height = 255
Left = 2520
TabIndex = 22
Top = 360
Width = 615
End
Begin VB.Label Label9
Caption = "X="
Height = 255
Left = 120
TabIndex = 21
Top = 360
Width = 615
End
End
Begin VB.Frame Frame2
Caption = "线条2"
Height = 1815
Left = 2520
TabIndex = 3
Top = 480
Width = 2055
Begin VB.TextBox Text8
Height = 270
Left = 600
TabIndex = 19
Text = "Text8"
Top = 1440
Width = 1215
End
Begin VB.TextBox Text7
Height = 270
Left = 600
TabIndex = 18
Text = "Text7"
Top = 1080
Width = 1215
End
Begin VB.TextBox Text6
Height = 270
Left = 600
TabIndex = 17
Text = "Text6"
Top = 720
Width = 1215
End
Begin VB.TextBox Text5
Height = 270
Left = 600
TabIndex = 16
Text = "Text5"
Top = 360
Width = 1215
End
Begin VB.Label Label8
Caption = "Y22="
Height = 255
Left = 120
TabIndex = 15
Top = 1440
Width = 615
End
Begin VB.Label Label7
Caption = "X22="
Height = 255
Left = 120
TabIndex = 14
Top = 1080
Width = 615
End
Begin VB.Label Label6
Caption = "Y21="
Height = 255
Left = 120
TabIndex = 13
Top = 720
Width = 855
End
Begin VB.Label Label5
Caption = "X21="
Height = 255
Left = 120
TabIndex = 12
Top = 360
Width = 615
End
End
Begin VB.Frame Frame1
Caption = "线条1"
Height = 1815
Left = 120
TabIndex = 2
Top = 480
Width = 2055
Begin VB.TextBox Text4
Height = 270
Left = 600
TabIndex = 11
Text = "Text4"
Top = 1440
Width = 1215
End
Begin VB.TextBox Text3
Height = 270
Left = 600
TabIndex = 10
Text = "Text3"
Top = 1080
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 600
TabIndex = 9
Text = "Text2"
Top = 720
Width = 1215
End
Begin VB.TextBox Text1
Height = 270
Left = 600
TabIndex = 8
Text = "Text1"
Top = 360
Width = 1215
End
Begin VB.Label Label4
Caption = "Y12="
Height = 255
Left = 120
TabIndex = 7
Top = 1440
Width = 735
End
Begin VB.Label Label3
Caption = "X12="
Height = 255
Left = 120
TabIndex = 6
Top = 1080
Width = 735
End
Begin VB.Label Label2
Caption = "Y11="
Height = 255
Left = 120
TabIndex = 5
Top = 720
Width = 1095
End
Begin VB.Label Label1
Caption = "X11="
Height = 255
Left = 120
TabIndex = 4
Top = 360
Width = 1095
End
End
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "钢筋重量(kg)="
Height = 180
Left = 120
TabIndex = 41
Top = 3480
Width = 1260
End
End
Attribute VB_Name = "frmcygs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'计算
Dim a11 As Double, b11 As Double, a12 As Double, b12 As Double
Dim a21 As Double, b21 As Double, a22 As Double, b22 As Double
Dim x As Double, y As Double
Dim k1 As Double, k2 As Double, b1 As Double, b2 As Double
On Error GoTo handlerror
'交点坐标
If SSTab1.Tab = 0 Then
a11 = Val(Text1.Text)
b11 = Val(Text2.Text)
a12 = Val(Text3.Text)
b12 = Val(Text4.Text)
a21 = Val(Text5.Text)
b21 = Val(Text6.Text)
a22 = Val(Text7.Text)
b22 = Val(Text8.Text)
If a11 <> a12 And a21 <> a22 Then
k1 = (b11 - b12) / (a11 - a12)
b1 = b11 - a11 * k1
k2 = (b21 - b22) / (a21 - a22)
b2 = b21 - a21 * k2
If k1 <> k2 Then
x = (b2 - b1) / (k1 - k2)
y = k1 * x + b1
End If
End If
If a11 = a12 And a21 <> a22 Then
k2 = (b21 - b22) / (a21 - a22)
b2 = b21 - a21 * k2
x = a11
y = k2 * a11 + b2
End If
If a11 <> a12 And a21 = a22 Then
k1 = (b11 - b12) / (a11 - a12)
b1 = b11 - a11 * k1
x = a21
y = k1 * a21 + b1
End If
Text9.Text = Trim(Str(x))
Text10.Text = Trim(Str(y))
If a11 = a12 And a21 = a22 Then
Text9.Text = ""
Text10.Text = ""
End If
End If
Exit Sub
handlerror:
xiansh = MsgBox("在计算时出错,请检查数据后再试试。", vbInformation, "问题提示")
End Sub
Private Sub Command2_Click()
'关闭
On Error GoTo handlerror
If SSTab1.Tab = 2 And rjsfzc = 88 Then
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " + "《钢筋重量》"
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " ----原始数据----"
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
For i = 0 To VSFlexGrid1.Rows - 1
kg1 = " "
kg2 = " "
kg3 = " "
kg4 = " "
If i <> 0 Then
If Len(VSFlexGrid1.TextMatrix(i, 0)) = 1 Then kg1 = " "
If Len(VSFlexGrid1.TextMatrix(i, 0)) = 2 Then kg1 = " "
If Len(VSFlexGrid1.TextMatrix(i, 0)) >= 3 Then kg1 = " "
If Len(VSFlexGrid1.TextMatrix(i, 1)) = 1 Then kg2 = " "
If Len(VSFlexGrid1.TextMatrix(i, 1)) = 2 Then kg2 = " "
If Len(VSFlexGrid1.TextMatrix(i, 1)) >= 3 Then kg2 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 1 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 2 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 3 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 4 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 5 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 6 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 7 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) = 8 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 2)) > 8 Then kg3 = " "
If Len(VSFlexGrid1.TextMatrix(i, 3)) = 1 Then kg4 = " "
If Len(VSFlexGrid1.TextMatrix(i, 3)) = 2 Then kg4 = " "
If Len(VSFlexGrid1.TextMatrix(i, 3)) = 3 Then kg4 = " "
If Len(VSFlexGrid1.TextMatrix(i, 3)) >= 4 Then kg4 = " "
End If
wenben = VSFlexGrid1.TextMatrix(i, 0) + kg1 + VSFlexGrid1.TextMatrix(i, 1) + kg2 + VSFlexGrid1.TextMatrix(i, 2) + kg3 + VSFlexGrid1.TextMatrix(i, 3) + kg4 + VSFlexGrid1.TextMatrix(i, 4)
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " + wenben
If VSFlexGrid1.TextMatrix(i, 1) = "" And VSFlexGrid1.TextMatrix(i, 4) = "" Then Exit For
Next i
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " ----计算结果----"
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label15.Caption
frmMain.Text1 = frmMain.Text1 & vbCrLf & " --------------------------------------"
End If
If SSTab1.Tab = 3 And rjsfzc = 88 And Val(Text18.Text) <> 0 Then
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " + "《扇形面积》"
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label16.Caption & Trim(Text15.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label17.Caption & Trim(Text16.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label18.Caption & Trim(Text17.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label19.Caption & Trim(Text18.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " --------------------------------------"
End If
If SSTab1.Tab = 3 And rjsfzc = 88 And Val(Text21.Text) <> 0 Then
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " + "《弓形面积》"
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label20.Caption & Trim(Text19.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label21.Caption & Trim(Text20.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & " " & Label22.Caption & Trim(Text21.Text)
frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
frmMain.Text1 = frmMain.Text1 & vbCrLf & " --------------------------------------"
End If
Unload Me
Exit Sub
handlerror:
End Sub
Private Sub Command3_Click()
'度到弧度
Dim du As Double, fd As Double
On Error GoTo handlerror
du = Val(Text11.Text)
fd = du * pi / 180
Text12.Text = Trim(Str(Format(fd, "###0.000000")))
Exit Sub
handlerror:
End Sub
Private Sub Command4_Click()
'弧度到度
Dim du As Double, fd As Double
On Error GoTo handlerror
fd = Val(Text12.Text)
du = fd * 180 / pi
Text11.Text = Trim(Str(Format(du, "###0.000000")))
Exit Sub
handlerror:
End Sub
Private Sub Command5_Click()
'摄氏度到华氏度
Dim ssd As Double, hsd As Double
On Error GoTo handlerror
ssd = Val(Text13.Text)
hsd = ssd * 9 / 5 + 32
Text14.Text = Trim(Str(Format(hsd, "###0.000000")))
Exit Sub
handlerror:
End Sub
Private Sub Command6_Click()
'华氏度到摄氏度
Dim ssd As Double, hsd As Double
On Error GoTo handlerror
hsd = Val(Text14.Text)
ssd = 5 * (hsd - 32) / 9
Text13.Text = Trim(Str(Format(ssd, "###0.000000")))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -