?? 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 = 7080
TabIndex = 2
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "OK"
Height = 495
Left = 7080
TabIndex = 1
Top = 240
Width = 1215
End
Begin VB.Frame Frame1
Height = 3135
Left = 120
TabIndex = 0
Top = 120
Width = 6855
Begin VB.ComboBox cboComPort
Height = 300
ItemData = "frmConfig.frx":0000
Left = 5280
List = "frmConfig.frx":0010
TabIndex = 14
Top = 1200
Width = 1095
End
Begin VB.ComboBox cboOutBufferSize
Height = 300
ItemData = "frmConfig.frx":0023
Left = 2280
List = "frmConfig.frx":0036
TabIndex = 12
Top = 2280
Width = 2700
End
Begin VB.ComboBox cboStop
Height = 300
ItemData = "frmConfig.frx":0056
Left = 2280
List = "frmConfig.frx":0063
TabIndex = 11
Top = 1800
Width = 2700
End
Begin VB.ComboBox cboData
Height = 300
ItemData = "frmConfig.frx":0072
Left = 2280
List = "frmConfig.frx":007F
TabIndex = 10
Top = 1320
Width = 2700
End
Begin VB.ComboBox cboCheck
Height = 300
ItemData = "frmConfig.frx":008C
Left = 2280
List = "frmConfig.frx":009F
TabIndex = 9
Top = 840
Width = 2700
End
Begin VB.ComboBox cboBaud
Height = 300
ItemData = "frmConfig.frx":00B2
Left = 2280
List = "frmConfig.frx":00C5
TabIndex = 8
Top = 405
Width = 2700
End
Begin VB.Label Label7
Alignment = 2 'Center
Caption = "使用如下COM口"
Height = 375
Left = 5160
TabIndex = 13
Top = 720
Width = 1455
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "發送緩沖區:"
Height = 375
Left = 240
TabIndex = 7
Top = 2400
Width = 2000
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 '串口號
Dim intOutBuffer 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)
intOutBuffer = Val(cboOutBufferSize.Text)
Call frmMain.SetComm(strSet, intPort, intOutBuffer)
Else
MsgBox ("請先關閉串口再進行設置!")
End If
Unload Me
End Sub
'***********************************************
'窗體初始化
'初始化顯示窗體
'***********************************************
Private Sub Form_Load()
Dim BaudLenth As Long
strSet = frmMain.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.cboComPort = frmMain.GetCommPort
frmConfig.cboOutBufferSize = frmMain.GetOutBuffer
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -