📄 rlctwoloop.frm
字号:
Width = 1695
End
Begin VB.Label Label6
Caption = "f:"
BeginProperty Font
Name = "Verdana"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 8
Top = 1680
Width = 735
End
Begin VB.Label Label5
Caption = "V1:"
BeginProperty Font
Name = "Verdana"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 7
Top = 1320
Width = 735
End
Begin VB.Label Label4
Caption = "L1:"
BeginProperty Font
Name = "Verdana"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 6
Top = 960
Width = 735
End
Begin VB.Label Label3
Caption = "C1:"
BeginProperty Font
Name = "Verdana"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 5
Top = 600
Width = 735
End
Begin VB.Label Label1
Caption = "R1:"
BeginProperty Font
Name = "Verdana"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 4
Top = 240
Width = 735
End
End
End
Begin VB.Line Line2
BorderWidth = 4
X1 = 0
X2 = 10080
Y1 = 12000
Y2 = 12000
End
Begin VB.Line Line1
BorderWidth = 4
X1 = 0
X2 = 10080
Y1 = 600
Y2 = 600
End
Begin VB.Label Label2
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "交流电路 - R, L, C双回路电路"
BeginProperty Font
Name = "Verdana"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 495
Left = 1440
TabIndex = 0
Top = 120
Width = 6375
End
Begin VB.Shape Shape1
BackColor = &H00FF8080&
BackStyle = 1 'Opaque
Height = 615
Left = 0
Top = 0
Width = 9735
End
End
Attribute VB_Name = "RLCTwoLoop"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim R5(3) As Single
Dim V5(3) As Single
Dim L5(3) As Single
Dim C5(3) As Single
Dim f5 As Single
Dim n As Integer
Dim Z1, Z2, Z3 As Single
Dim D, D1, D2 As Single
Dim Z12, Z23, Z21, V12, V32 As Single
Dim I51, I52, VA As Single
Dim XL5(3) As Single
Dim XC5(3) As Single
Dim X, Y As Single
Const vbkeyDecPt = 46
Const pi = 22 / 7
Private Sub calculate_Click()
If TextR50.Text = " " Then
MsgBox "请输入电阻 1", vbInformation, "提示"
ElseIf TextR51.Text = " " Then
MsgBox "请输入电阻 2", vbInformation, "提示"
ElseIf TextR52.Text = " " Then
MsgBox "请输入电阻 3", vbInformation, "提示"
End If
R5(0) = Val(TextR50.Text)
R5(1) = Val(TextR51.Text)
R5(2) = Val(TextR52.Text)
L5(0) = Val(TextL50.Text)
L5(1) = Val(TextL51.Text)
L5(2) = Val(TextL52.Text)
C5(0) = Val(TextC50.Text)
C5(1) = Val(TextC51.Text)
C5(2) = Val(TextC52.Text)
V5(0) = Val(TextV50.Text)
V5(1) = Val(TextV51.Text)
V5(2) = Val(TextV52.Text)
f5 = Val(Textf5.Text)
For n = 0 To 2
If L5(n) = 0 Then
XL5(n) = 0
Else
XL5(n) = 2 * pi * f5 * L5(n)
End If
Next n
For n = 0 To 2
If C5(n) = 0 Or f5 = 0 Then
XC5(n) = 0
Else
XC5(n) = 1 / (2 * pi * f5 * C5(n))
End If
Next n
Z1 = (R5(0) ^ 2 + (XL5(0) - XC5(0)) ^ 2) ^ (1 / 2)
Z2 = (R5(1) ^ 2 + (XL5(1) - XC5(1)) ^ 2) ^ (1 / 2)
Z3 = (R5(2) ^ 2 + (XL5(2) - XC5(2)) ^ 2) ^ (1 / 2)
Z12 = Z1 + Z2
Z23 = -(Z2 + Z3)
Z21 = -Z2
V12 = V5(0) - V5(1)
V32 = V5(2) - V5(1)
If Option1.Value = True Then
D = ((Z12 * Z23) + (Z21) ^ 2)
D1 = ((Z23 * V12) - (Z21 * V32))
D2 = (Z12 * V32) + (Z21 * V12)
I51 = D1 / D
I52 = D2 / D
LblI51.Caption = Format$(I51, "###.000000A")
LblI52.Caption = Format$(I52, "###.000000A")
LblVA.Caption = " "
ElseIf Option2.Value = True Then
Y = ((V5(0) * Z2 * Z3) + (V5(2) * Z1 * Z2) + (V5(1) * Z1 * Z3))
X = ((Z2 * Z3) + (Z1 * Z3) + (Z1 * Z2))
VA = Y / X
LblVA.Caption = Format$(VA, "###.000000V")
LblI51.Caption = " "
LblI52.Caption = " "
End If
End Sub
Private Sub clear_Click()
TextR50.Text = " "
TextR51.Text = " "
TextR52.Text = " "
TextL50.Text = " "
TextL51.Text = " "
TextL52.Text = " "
TextC50.Text = " "
TextC51.Text = " "
TextC52.Text = " "
TextV50.Text = " "
TextV51.Text = " "
TextV52.Text = " "
LblVA.Caption = " "
LblI51.Caption = " "
LblI52.Caption = " "
End Sub
Private Sub Command1_Click()
Unload Me
Splash.Show
End Sub
Private Sub TextC50_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextC51_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextC52_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub Textf5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextL50_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextL51_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextL52_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextR50_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextR51_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextR52_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextV50_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextV51_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub TextV52_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -