📄 serialport.frm
字号:
VERSION 5.00
Begin VB.Form SerialPort
Caption = "串口演示"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 345
ClientWidth = 4515
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3150
ScaleWidth = 4515
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
Caption = "握手协议"
Height = 1875
Left = 2520
TabIndex = 5
Top = 1080
Width = 1875
Begin VB.OptionButton Option1
Caption = "RTS/CTS"
Height = 255
Left = 240
TabIndex = 9
Top = 315
Value = -1 'True
Width = 1095
End
Begin VB.OptionButton Option2
Caption = "comNone"
Height = 255
Left = 240
TabIndex = 8
Top = 675
Width = 1095
End
Begin VB.OptionButton Option3
Caption = "XON/OFF"
Height = 255
Left = 240
TabIndex = 7
Top = 1035
Width = 1095
End
Begin VB.OptionButton Option4
Caption = "comRTSXOnXOff"
Height = 375
Left = 240
TabIndex = 6
Top = 1350
Width = 1575
End
End
Begin VB.Frame Frame1
Caption = "端口号"
Height = 855
Left = 135
TabIndex = 2
Top = 1935
Width = 2055
Begin VB.OptionButton OptionCom1
Caption = "COM1"
Height = 375
Left = 180
TabIndex = 4
Top = 270
Value = -1 'True
Width = 975
End
Begin VB.OptionButton OptionCom2
Caption = "COM2"
Height = 375
Left = 1125
TabIndex = 3
Top = 270
Width = 735
End
End
Begin VB.CommandButton Ok
Caption = "确定"
Height = 495
Left = 2790
TabIndex = 1
Top = 270
Width = 1320
End
Begin VB.ComboBox Combo1
Height = 300
Left = 120
Style = 2 'Dropdown List
TabIndex = 0
Top = 360
Width = 2115
End
End
Attribute VB_Name = "SerialPort"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Combo1_Change()
Setport.strgSetPort = Combo1.Text
End Sub
Private Sub Form_Load()
Combo1.AddItem "4800, N, 8, 1"
Combo1.AddItem "9600,N,8,1", 0
Combo1.AddItem "19200,N,8,1"
End Sub
Private Sub Ok_Click()
Setport.strgSetPort = Combo1.Text
Unload Me
End Sub
Private Sub Option1_Click()
Setport.igFlowControl = comRTS
End Sub
Private Sub Option2_Click()
Setport.igFlowControl = comNone
End Sub
Private Sub Option3_Click()
Setport.igFlowControl = comXOnXoff
End Sub
Private Sub Option4_Click()
Setport.igFlowControl = comRTSXOnXOff
End Sub
Private Sub OptionCom1_Click()
Setport.igSelectPort = igCom1
End Sub
Private Sub OptionCom2_Click()
Setport.igSelectPort = igCom2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -