📄 set.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form SETT
BorderStyle = 3 'Fixed Dialog
Caption = "COM1端口设置"
ClientHeight = 3795
ClientLeft = 45
ClientTop = 435
ClientWidth = 4425
Icon = "SET.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3795
ScaleWidth = 4425
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton B_CANCEL
Caption = "取消"
Height = 375
Left = 3120
TabIndex = 9
Top = 3360
Width = 1215
End
Begin VB.CommandButton B_ok
Caption = "确认"
Height = 375
Left = 1800
TabIndex = 8
Top = 3360
Width = 1215
End
Begin VB.CommandButton B_DEFAULT
Caption = "还原默认"
Height = 375
Left = 2640
TabIndex = 7
Top = 2640
Width = 1335
End
Begin VB.Frame Frame1
Height = 2655
Left = 240
TabIndex = 1
Top = 480
Width = 3975
Begin VB.ComboBox Combo5
BackColor = &H80000004&
Height = 300
Left = 1800
TabIndex = 14
Text = "无"
Top = 1680
Width = 1935
End
Begin VB.ComboBox Combo4
BackColor = &H80000004&
Height = 300
Left = 1800
TabIndex = 13
Text = "1"
Top = 1320
Width = 1935
End
Begin VB.ComboBox Combo3
BackColor = &H80000004&
Height = 300
Left = 1800
TabIndex = 12
Text = "无"
Top = 960
Width = 1935
End
Begin VB.ComboBox Combo2
BackColor = &H80000004&
Height = 300
Left = 1800
TabIndex = 11
Text = "8"
Top = 600
Width = 1935
End
Begin VB.ComboBox Combo1
BackColor = &H80000004&
Height = 300
Left = 1800
TabIndex = 10
Text = "9600"
Top = 240
Width = 1935
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "数据流控制(&F):"
Height = 255
Left = 120
TabIndex = 6
Top = 1680
Width = 1455
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "停止位(&S):"
Height = 255
Left = 120
TabIndex = 5
Top = 1320
Width = 1455
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "奇偶校验(&P):"
Height = 255
Left = 120
TabIndex = 4
Top = 960
Width = 1455
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "数据位(&D):"
Height = 255
Left = 120
TabIndex = 3
Top = 600
Width = 1455
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "每秒位数(&B:)"
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 1455
End
End
Begin MSComctlLib.TabStrip TabStrip1
Height = 3135
Left = 120
TabIndex = 0
Top = 120
Width = 4215
_ExtentX = 7435
_ExtentY = 5530
Separators = -1 'True
_Version = 393216
BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628}
NumTabs = 1
BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "端口设置"
ImageVarType = 2
EndProperty
EndProperty
End
Begin MSCommLib.MSComm MSComm
Left = 3360
Top = 1200
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
End
Attribute VB_Name = "SETT"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub B_CANCEL_Click()
'comnum = 1 '防止影响到当前通讯的设置
Unload Me
End Sub
Private Sub B_DEFAULT_Click()
Combo1.Text = 9600
Combo2.Text = 8
Combo3.Text = "无"
Combo4.Text = 1
Combo5.Text = "无"
End Sub
Private Sub B_ok_Click()
Fmain.Caption = "当前连" & TCOM.COMNAME
com_b = Combo1.Text
com_d = Combo2.Text
com_s = Combo4.Text
Select Case Combo3.Text
Case "奇"
com_p = "M"
Case "偶"
com_p = "O"
Case "无"
com_p = "N"
End Select
'控件设置
With Fmain.MSComm
.CommPort = CInt(Right(TCOM.COMPORT, 1))
.Settings = Str(com_b) & com_p & Str(com_d) & Str(com_s)
.InputMode = TCOM.COMMODE
.InBufferSize = 3000
.OutBufferSize = 3000
.RThreshold = 1
.SThreshold = 0
.OutBufferCount = 0
.InBufferCount = 0
End With
'On Error GoTo errhandle 错误消息不能被捕获
Fmain.MSComm.PortOpen = True
Fmain.StatusBar.Panels(1).Text = TCOM.COMPORT & "已连接"
Fmain.Tsend.Enabled = True
Fmain.M_SAVE.Enabled = True
Fmain.M_SET.Enabled = True
is_cominuse = True
'Fmain.M_HEX = True
Unload Me
End Sub
Private Sub Form_Load()
Me.Caption = COMPORT & "端口设置"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -