📄 seriescircuit.frm
字号:
Alignment = 2 'Center
BackColor = &H80000004&
Caption = "V2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000007&
Height = 255
Left = 5400
TabIndex = 9
Top = 1920
Width = 495
End
Begin VB.Label Label5
Alignment = 2 'Center
BackColor = &H80000004&
Caption = "V1"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000007&
Height = 255
Left = 3000
TabIndex = 8
Top = 1905
Width = 495
End
Begin VB.Line Line11
BorderWidth = 2
X1 = 1920
X2 = 2040
Y1 = 2280
Y2 = 2400
End
Begin VB.Line Line10
BorderWidth = 2
X1 = 1800
X2 = 1920
Y1 = 2400
Y2 = 2280
End
Begin VB.Line Line9
BorderWidth = 2
X1 = 4560
X2 = 6960
Y1 = 3000
Y2 = 3000
End
Begin VB.Line Line8
BorderWidth = 2
X1 = 6960
X2 = 6960
Y1 = 1560
Y2 = 3000
End
Begin VB.Line Line7
BorderWidth = 2
X1 = 6240
X2 = 6960
Y1 = 1560
Y2 = 1560
End
Begin VB.Line Line6
BorderWidth = 2
X1 = 1920
X2 = 2640
Y1 = 1560
Y2 = 1560
End
Begin VB.Line Line5
BorderWidth = 2
X1 = 1920
X2 = 1920
Y1 = 3000
Y2 = 1560
End
Begin VB.Line Line4
BorderWidth = 2
X1 = 4440
X2 = 1920
Y1 = 3000
Y2 = 3000
End
Begin VB.Line Line3
BorderWidth = 2
X1 = 4560
X2 = 4560
Y1 = 2760
Y2 = 3240
End
Begin VB.Line Line2
BorderWidth = 2
X1 = 4440
X2 = 4440
Y1 = 2640
Y2 = 3360
End
Begin VB.Line Line1
BorderWidth = 2
X1 = 3840
X2 = 5040
Y1 = 1560
Y2 = 1560
End
Begin VB.Shape Shape2
BorderWidth = 2
Height = 255
Left = 5040
Top = 1440
Width = 1215
End
Begin VB.Shape Shape1
BorderWidth = 2
Height = 255
Left = 2640
Top = 1440
Width = 1215
End
Begin VB.Label Number
Alignment = 2 'Center
BackColor = &H000000FF&
BorderStyle = 1 'Fixed Single
Caption = "1"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3360
TabIndex = 6
Top = 4680
Width = 495
End
Begin VB.Label Label3
BackColor = &H80000004&
Caption = "电阻值 ="
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 4
Top = 4680
Width = 2175
End
Begin VB.Label Label2
BackColor = &H80000004&
Caption = "供电电压 (Vs) ="
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 2
Top = 4200
Width = 2535
End
Begin VB.Label Label1
BackColor = &H80000004&
Caption = "所需电阻 ="
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 1
Top = 3720
Width = 2775
End
End
Attribute VB_Name = "SeriesCircuit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Counter As Integer
Dim Max As Integer
Dim Res(10) As Single
Dim Vol(10) As Single
Dim it As Single
Dim VS As Single
Dim rt As Single
Dim num As Integer
Const vbkeyDecPt = 46
Private Sub Command1_Click()
Unload Me
Splash.Show
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub CountUp_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 Form_Load()
Counter = 1
Results.Visible = False
rt = 0
End Sub
Private Sub MainMenu_Click()
Splash.Show
Unload SeriesCircuit
End Sub
Private Sub HMR_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 Repeat_Click()
Unload SeriesCircuit
Load SeriesCircuit
SeriesCircuit.Show
End Sub
Private Sub ResValEnter_Click()
If Val(HMR.Text) = 0 Then
MsgBox ("电阻阻值不能为 0 !"), vbCritical, "提示"
GoTo 1
End If
If CountUp.Text = "" Then
MsgBox ("请为这个电阻输入一个阻值!"), vbInformation, "提示"
GoTo 1
End If
CountUp.SetFocus
If Val(Number.Caption) = Val(HMR.Text) Then
ResValEnter.Visible = False
Number.Visible = False
End If
Max = Val(HMR.Text) + 1
Res(Counter) = Val(CountUp.Text)
CountUp.Text = ""
If Counter = Max - 1 Then
For num = 1 To Max - 1
rt = rt + Res(num)
Next num
Results.Visible = True
Results.Print "Resistance Total = "; rt; "Ohms"
it = Val(VoltVal.Text) / rt '输出工作电流
Results.Print "Total Current ="; it; "Amps"
For num = 1 To Max - 1
Vol(num) = it * Res(num) '每个电阻的工作电压
Results.Print "较差电压 R"; num; "="; Vol(num); "V"
Next num
End If
Counter = Counter + 1
Number.Caption = Counter
If Counter = Max Then
Results.Visible = True
End If
1 End Sub
Private Sub SimpleC_Click()
SimpleCircuit.Show
Unload SeriesCircuit
End Sub
Private Sub ParallelC_Click()
ParallelCircuit.Show
Unload SeriesCircuit
End Sub
Private Sub AboutO_Click()
About.Show
End Sub
Private Sub VoltVal_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 + -