📄 frm_config.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Config
BorderStyle = 1 'Fixed Single
ClientHeight = 4050
ClientLeft = 45
ClientTop = 435
ClientWidth = 4965
Icon = "Frm_Config.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4050
ScaleWidth = 4965
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo4
Height = 300
ItemData = "Frm_Config.frx":030A
Left = 2040
List = "Frm_Config.frx":0311
TabIndex = 15
Top = 2160
Width = 2175
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Frm_Config.frx":0318
Left = 2040
List = "Frm_Config.frx":0334
TabIndex = 14
Top = 720
Width = 2175
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退出"
Height = 375
Left = 2760
TabIndex = 11
Top = 3480
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 840
TabIndex = 10
Top = 3480
Width = 975
End
Begin VB.OptionButton Option3
Caption = "无"
Height = 255
Left = 3600
TabIndex = 9
Top = 2760
Width = 735
End
Begin VB.OptionButton Option2
Caption = "偶"
Height = 255
Left = 2760
TabIndex = 8
Top = 2760
Width = 615
End
Begin VB.OptionButton Option1
Caption = "奇"
Height = 255
Left = 1920
TabIndex = 7
Top = 2760
Width = 615
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "Frm_Config.frx":0368
Left = 2040
List = "Frm_Config.frx":036F
TabIndex = 5
Top = 1680
Width = 2175
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Frm_Config.frx":0376
Left = 2040
List = "Frm_Config.frx":037D
TabIndex = 2
Top = 1200
Width = 2175
End
Begin VB.PictureBox pic
Appearance = 0 'Flat
BackColor = &H00808080&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 435
Left = 0
ScaleHeight = 435
ScaleWidth = 10815
TabIndex = 0
Top = 0
Width = 10815
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "参数配置"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 1920
TabIndex = 1
Top = 120
Width = 1095
End
End
Begin VB.Label Label6
Caption = "停 止 位:"
Height = 255
Left = 720
TabIndex = 13
Top = 2280
Width = 975
End
Begin VB.Label Label2
Caption = "数 据 位:"
Height = 375
Left = 720
TabIndex = 12
Top = 1680
Width = 975
End
Begin VB.Line Line1
X1 = 480
X2 = 4560
Y1 = 3360
Y2 = 3360
End
Begin VB.Label Label5
Caption = "奇偶校验:"
Height = 255
Left = 720
TabIndex = 6
Top = 2760
Width = 975
End
Begin VB.Label Label4
Caption = "波 特 率:"
Height = 255
Left = 720
TabIndex = 4
Top = 1200
Width = 975
End
Begin VB.Label Label3
Caption = "端 口:"
Height = 255
Left = 720
TabIndex = 3
Top = 720
Width = 975
End
End
Attribute VB_Name = "Frm_Config"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo ComErr
Dim potStr As String
potStr = Trim(Combo1.Text)
If Len(potStr) >= 4 Then
If Mid(potStr, 1, 3) = "COM" Then
PortItem = Val(Mid(potStr, 4, 1)) '端口号
End If
End If
BaudRate = Combo2.Text '波特率
DataBit = Combo3.Text '数据位
StopBit = Combo4.Text '停止位
If Option1.Value = True Then '奇偶校验
ParityCheck = -1 '奇
ElseIf Option2.Value = True Then
ParityCheck = 1 '偶
Else
ParityCheck = 0 '无
End If
MsgBox "各参数设置成功!", vbExclamation + vbOKOnly, "提示!"
Exit Sub
ComErr:
MsgBox "请检查各参数是否已选择!", vbExclamation + vbOKOnly, "提示!"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.Text = "COM1"
Combo2.Text = "9600"
Combo3.Text = "8"
Combo4.Text = "1"
Option3.Value = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -