📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
BorderStyle = 1 'Fixed Single
Caption = "串口设置"
ClientHeight = 1455
ClientLeft = 4515
ClientTop = 3420
ClientWidth = 3315
Icon = "Form2.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1455
ScaleWidth = 3315
Begin VB.CommandButton Command1
Caption = "关 闭"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1860
TabIndex = 5
Top = 900
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 315
Left = 1740
TabIndex = 3
Top = 420
Width = 1335
End
Begin VB.Frame Frame1
Caption = "串口选择"
Height = 1035
Left = 180
TabIndex = 0
Top = 180
Width = 1275
Begin VB.OptionButton Option1
Caption = "Com1"
Height = 375
Left = 240
TabIndex = 2
Top = 240
Width = 855
End
Begin VB.OptionButton Option2
Caption = "Com2"
Height = 255
Left = 240
TabIndex = 1
Top = 660
Width = 855
End
End
Begin VB.Label Label4
Caption = "波特率选择"
Height = 255
Left = 1860
TabIndex = 4
Top = 180
Width = 1095
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Select Case Combo1.ListIndex
Case 0
Form1.MSComm1.Settings = "9600,N,8,1"
Com1Txt = "default"
Case 1
Form1.MSComm1.Settings = "2400,N,8,1"
Com1Txt = "2400"
Case 2
Form1.MSComm1.Settings = "4800,N,8,1"
Com1Txt = "4800"
Case 3
Form1.MSComm1.Settings = "9600,N,8,1"
Com1Txt = "9600"
Case 4
Form1.MSComm1.Settings = "19200,N,8,1"
Com1Txt = "19200"
Case 5
Form1.MSComm1.Settings = "38400,N,8,1"
Com1Txt = "38400"
Case 6
Form1.MSComm1.Settings = "57600,N,8,1"
Com1Txt = "57600"
End Select
End Sub
Private Sub Command1_Click()
Unload Form2
End Sub
Private Sub Form_Load()
Combo1.AddItem "default"
Combo1.AddItem "2400"
Combo1.AddItem "4800"
Combo1.AddItem "9600"
Combo1.AddItem "19200"
Combo1.AddItem "38400"
Combo1.AddItem "57600"
Option1.Value = Com1Sel
Option2.Value = Not Com1Sel
Combo1.Text = Com1Txt
End Sub
Private Sub Option1_Click()
Com1Sel = True
Form1.MSComm1.PortOpen = False
Form1.MSComm1.CommPort = 1
Form1.MSComm1.PortOpen = True
End Sub
Private Sub Option2_Click()
Com1Sel = False
Form1.MSComm1.PortOpen = False
Form1.MSComm1.CommPort = 2
Form1.MSComm1.PortOpen = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -