📄 frmconfig.frm
字号:
VERSION 5.00
Begin VB.Form frmConfig
BorderStyle = 1 'Fixed Single
Caption = "串口设置"
ClientHeight = 3420
ClientLeft = 5385
ClientTop = 5520
ClientWidth = 8310
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3420
ScaleWidth = 8310
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 495
Left = 6840
TabIndex = 2
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "OK"
Height = 495
Left = 6840
TabIndex = 1
Top = 240
Width = 1215
End
Begin VB.Frame Frame1
Height = 3135
Left = 120
TabIndex = 0
Top = 120
Width = 6495
Begin VB.ComboBox cboComPort
Height = 315
ItemData = "frmConfig.frx":0000
Left = 2280
List = "frmConfig.frx":0010
TabIndex = 12
Top = 2280
Width = 2655
End
Begin VB.ComboBox cboStop
Height = 300
ItemData = "frmConfig.frx":0023
Left = 2280
List = "frmConfig.frx":0030
TabIndex = 10
Top = 1800
Width = 2700
End
Begin VB.ComboBox cboData
Height = 300
ItemData = "frmConfig.frx":003F
Left = 2280
List = "frmConfig.frx":004C
TabIndex = 9
Top = 1320
Width = 2700
End
Begin VB.ComboBox cboCheck
Height = 300
ItemData = "frmConfig.frx":0059
Left = 2280
List = "frmConfig.frx":006C
TabIndex = 8
Top = 840
Width = 2700
End
Begin VB.ComboBox cboBaud
Height = 300
ItemData = "frmConfig.frx":007F
Left = 2280
List = "frmConfig.frx":0092
TabIndex = 7
Top = 405
Width = 2700
End
Begin VB.Label Label7
Alignment = 2 'Center
Caption = "COM口:"
Height = 375
Left = 1440
TabIndex = 11
Top = 2400
Width = 855
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "停止位:"
Height = 375
Left = 240
TabIndex = 6
Top = 1920
Width = 2000
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "数据位:"
Height = 255
Left = 240
TabIndex = 5
Top = 1440
Width = 2000
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "校验:"
Height = 375
Left = 240
TabIndex = 4
Top = 960
Width = 1995
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "波特率:"
Height = 375
Left = 240
TabIndex = 3
Top = 480
Width = 1995
End
End
End
Attribute VB_Name = "frmConfig"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'***********************************************
Dim strSet As String '串口设置
Dim intPort As Long '串口号
'***********************************************
'***********************************************
'取消
'响应取消按钮,卸载参数设置窗体
'***********************************************
Private Sub cmdCancel_Click()
Unload Me
End Sub
'***********************************************
'确定
'响应确定按钮,进行参数设置
'***********************************************
Private Sub cmdOk_Click()
If intCommFlag = 0 Then
strSet = cboBaud.Text + "," + cboCheck.Text + "," + cboData.Text + "," + cboStop.Text
intPort = Val(cboComPort.Text)
Call Form1.SetComm(strSet, intPort)
Else
MsgBox ("请先关闭串口再进行设置!")
End If
Unload Me
End Sub
'***********************************************
'窗体初始化
'初始化显示窗体
'***********************************************
Private Sub Form_Load()
Dim BaudLenth As Long
strSet = Form1.GetSettings
If Mid(strSet, 5, 1) = "," Then
BaudLenth = 4
Else
BaudLenth = 5
End If
' frmConfig.cboBaud.Text = Mid(strSet, 1, BaudLenth)
' frmConfig.cboCheck.Text = Mid(strSet, BaudLenth + 2, 1)
' frmConfig.cboData.Text = Mid(strSet, BaudLenth + 4, 1)
' frmConfig.cboStop.Text = Mid(strSet, BaudLenth + 6, Len(strSet) - BaudLenth - 5)
frmConfig.cboBaud.Text = 9600
frmConfig.cboCheck.Text = "N"
frmConfig.cboData.Text = 8
frmConfig.cboStop.Text = 1
frmConfig.cboComPort = 1
' frmConfig.cboComPort = Form1.GetCommPort
' frmConfig.cboOutBufferSize = Form1.GetOutBuffer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -