?? dlgsetcomm.frm
字號:
VERSION 5.00
Begin VB.Form dlgSetComm
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdOk
Caption = "確定"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 795
TabIndex = 6
Top = 2520
Width = 1215
End
Begin VB.ComboBox cmbBoundary
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "dlgSetComm.frx":0000
Left = 1200
List = "dlgSetComm.frx":0037
Style = 2 'Dropdown List
TabIndex = 5
Top = 840
Width = 1212
End
Begin VB.ComboBox cmbComport
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "dlgSetComm.frx":00A9
Left = 1200
List = "dlgSetComm.frx":00C5
Style = 2 'Dropdown List
TabIndex = 4
Top = 240
Width = 612
End
Begin VB.ComboBox cmbDatalen
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "dlgSetComm.frx":00E1
Left = 3480
List = "dlgSetComm.frx":00F4
Style = 2 'Dropdown List
TabIndex = 3
Top = 840
Width = 612
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2715
TabIndex = 2
Top = 2520
Width = 1215
End
Begin VB.ComboBox cmbStopbit
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "dlgSetComm.frx":0107
Left = 3480
List = "dlgSetComm.frx":0114
Style = 2 'Dropdown List
TabIndex = 1
Top = 1440
Width = 732
End
Begin VB.ComboBox cmbParity
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "dlgSetComm.frx":0123
Left = 1200
List = "dlgSetComm.frx":0136
Style = 2 'Dropdown List
TabIndex = 0
Top = 1440
Width = 1212
End
Begin VB.Label Label1
Caption = "波特率"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 480
TabIndex = 11
Top = 840
Width = 735
End
Begin VB.Label Label2
Caption = "通訊口"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 480
TabIndex = 10
Top = 240
Width = 735
End
Begin VB.Label Label3
Caption = "字長"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 2640
TabIndex = 9
Top = 840
Width = 495
End
Begin VB.Label Label4
Caption = "停止位"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 2640
TabIndex = 8
Top = 1440
Width = 735
End
Begin VB.Label Label5
Caption = "校驗"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 480
TabIndex = 7
Top = 1440
Width = 495
End
End
Attribute VB_Name = "dlgSetComm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Bound, Datalen, Stopbit As Single
Dim para, ParaList As String
Private Sub cmdCancel_Click()
Me.Hide
End Sub
Private Sub cmdOK_Click()
On Error GoTo ErrHandle
Frmmian.MSComm1.CommPort = cmbComport.Text
Frmmian.MSComm1.Settings = _
cmbBoundary.Text + "," + _
Mid(ParaList, cmbParity.ListIndex + 1, 1) + "," + _
cmbDatalen.Text + "," + cmbStopbit.Text
Bound = cmbBoundary.Text
para = Mid(ParaList, cmbParity.ListIndex + 1, 1)
Datalen = cmbDatalen.Text
Stopbit = cmbStopbit.Text
SetMessage
Me.Hide
Exit Sub
ErrHandle:
MsgBox "錯誤的設置!", vbInformation, "端口設置錯誤"
End Sub
Private Sub Form_activate()
cmbComport.Text = Frmmian.MSComm1.CommPort
cmbBoundary.Text = Bound
cmbParity.ListIndex = InStr(1, ParaList, UCase(para)) - 1
cmbDatalen.Text = Datalen
cmbStopbit.Text = Stopbit
End Sub
Private Sub Form_Load()
Bound = 9600
para = "n"
Datalen = 8
Stopbit = 1
ParaList = "EOMSN"
Form_activate
SetMessage
End Sub
Private Sub SetMessage()
Frmmian.lblSetting.Caption = "端口號:" + cmbComport.Text + _
Chr(13) + Chr(10) + _
"波特率:" + cmbBoundary.Text + _
",校驗方式:" + cmbParity.Text + _
"," + cmbDatalen.Text + "位字長 ," + _
cmbStopbit + "位停止位"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -