📄 frmconfig.frm
字号:
VERSION 5.00
Begin VB.Form frmConfig
Caption = "Configuration"
ClientHeight = 1530
ClientLeft = 60
ClientTop = 345
ClientWidth = 2970
LinkTopic = "Form1"
ScaleHeight = 1530
ScaleWidth = 2970
StartUpPosition = 3 'Windows Default
Begin VB.ComboBox cboComPort
Height = 315
Left = 240
TabIndex = 1
Top = 720
Width = 1335
End
Begin VB.ComboBox cboBaud
Height = 315
Left = 240
TabIndex = 0
Top = 240
Width = 1335
End
Begin VB.Label Label2
Caption = "Com Port"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1620
TabIndex = 3
Top = 780
Width = 855
End
Begin VB.Label Label1
Caption = "Baud"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1680
TabIndex = 2
Top = 300
Width = 615
End
End
Attribute VB_Name = "frmConfig"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cboBaud_Click()
mBaud = Val(cboBaud.Text)
frmComm.MSComm1.Settings = Str(mBaud) & ",N,8,1"
End Sub
Private Sub cboComPort_Click()
mComPort = Val(Right(cboComPort.Text, 1))
frmComm.MSComm1.PortOpen = False
frmComm.MSComm1.CommPort = mComPort
frmComm.MSComm1.PortOpen = True
End Sub
Private Sub Form_Load()
'xDebug.Print "Config Start", frmComm.MSComm1.PortOpen
Call InitConfig
cboBaud.Text = mBaud
cboComPort.Text = "Com" & Str(mComPort)
End Sub
Public Sub InitConfig()
Dim j As Variant
cboBaud.AddItem 1200
cboBaud.AddItem 2400
cboBaud.AddItem 4800
cboBaud.AddItem 9600
cboBaud.AddItem 19200
cboBaud.AddItem 38400
cboBaud.AddItem 57600
cboBaud.AddItem 115200
'xDebug.Print "NumPorts", NumberOfPorts
For j = 1 To NumberOfPorts
cboComPort.AddItem CommPorts(j)
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -