📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3225
ClientLeft = 60
ClientTop = 450
ClientWidth = 5205
LinkTopic = "Form2"
ScaleHeight = 3225
ScaleWidth = 5205
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 495
Left = 3360
TabIndex = 12
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Default = -1 'True
Height = 495
Left = 600
TabIndex = 11
Top = 2520
Width = 1215
End
Begin VB.Frame Frame1
Caption = "设置"
Height = 2175
Left = 120
TabIndex = 0
Top = 120
Width = 4935
Begin VB.ComboBox Combo1
Height = 300
Index = 4
ItemData = "Form2.frx":0000
Left = 3480
List = "Form2.frx":0002
TabIndex = 5
Text = "1"
Top = 1560
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Index = 3
ItemData = "Form2.frx":0004
Left = 1200
List = "Form2.frx":0006
TabIndex = 4
Text = "8"
Top = 1560
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Index = 2
ItemData = "Form2.frx":0008
Left = 3480
List = "Form2.frx":000A
TabIndex = 3
Text = "N"
Top = 960
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Index = 1
ItemData = "Form2.frx":000C
Left = 1200
List = "Form2.frx":000E
TabIndex = 2
Text = "2400"
Top = 960
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
ItemData = "Form2.frx":0010
Left = 1200
List = "Form2.frx":0012
TabIndex = 1
Text = "COM1"
Top = 360
Width = 1095
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "停止位:"
Height = 180
Left = 2760
TabIndex = 10
Top = 1560
Width = 720
End
Begin VB.Label Label4
Caption = "数据位:"
Height = 375
Left = 360
TabIndex = 9
Top = 1560
Width = 975
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "校验位:"
Height = 180
Left = 2760
TabIndex = 8
Top = 960
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "波特率:"
Height = 300
Left = 360
TabIndex = 7
Top = 960
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "串口:"
Height = 180
Left = 480
TabIndex = 6
Top = 480
Width = 540
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim Delay As Integer, COM As Integer
Dim Comport As Integer
Dim Comsetting As String
If Form1.Timer1.Enabled = False Then Form1.Timer1.Enabled = True
If Form1.MSComm1.PortOpen = False Then MsgBox "必须打开串口后才能设置。"
Select Case COM
Case 1
Form1.MSComm1.CommPort = 1
Case 2
Form1.MSComm1.CommPort = 2
Case 3
Form1.MSComm1.CommPort = 3
Case 4
Form1.MSComm1.CommPort = 4
End Select
Combo1(0).Text = COM
Comsetting = Combo1(1).Text & "," & Combo1(2).Text & "," & Combo1(3).Text & "," & Combo1(4).Text
Comsetting = Form1.MSComm1.Settings
Form2.Hide
End Sub
Private Sub Command2_Click()
Form2.Hide
Form1.Show
Comsetting = "2400,N,8,1"
End Sub
Private Sub Form_Load()
Combo1(0).AddItem "COM1"
Combo1(0).AddItem "COM2"
Combo1(0).AddItem "COM3"
Combo1(0).AddItem "COM4"
Combo1(1).AddItem "2400"
Combo1(1).AddItem "4800"
Combo1(1).AddItem "9600"
Combo1(1).AddItem "12000"
Combo1(2).AddItem "N"
Combo1(2).AddItem "E"
Combo1(2).AddItem "A"
Combo1(3).AddItem "8"
Combo1(3).AddItem "7"
Combo1(3).AddItem "6"
Combo1(4).AddItem "1"
Combo1(4).AddItem "2"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -