📄 config.frm
字号:
VERSION 5.00
Begin VB.Form config
BorderStyle = 3 'Fixed Dialog
Caption = "设置参数"
ClientHeight = 4350
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 5100
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4350
ScaleWidth = 5100
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 2895
Left = 240
TabIndex = 2
Top = 240
Width = 4575
Begin VB.TextBox txtTime
Height = 495
Left = 1560
TabIndex = 8
Text = "1000"
Top = 1680
Width = 975
End
Begin VB.TextBox txtSetting
Height = 375
Left = 1560
TabIndex = 6
Text = "9600,n,8,1"
Top = 1080
Width = 975
End
Begin VB.TextBox txtPort
Height = 375
Left = 1560
TabIndex = 4
Text = "1"
Top = 360
Width = 975
End
Begin VB.Label Label4
Caption = "ms 发送一次"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 9
Top = 1800
Width = 1095
End
Begin VB.Label Label3
Caption = "发送时间间隔:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 7
Top = 1800
Width = 1575
End
Begin VB.Label Label2
Caption = "串口设置:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 5
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "串口选择:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 3
Top = 480
Width = 1935
End
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 1
Top = 3360
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 0
Top = 3360
Width = 1215
End
End
Attribute VB_Name = "config"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
config.Hide
Unload config
End Sub
Private Sub cmdOk_Click()
On Error GoTo SettingError
intPort = Val(config.txtPort.Text)
intTime = Val(config.txtTime.Text)
strSet = config.txtSetting.Text
If Not Main.MSComm1.PortOpen Then
Main.MSComm1.CommPort = intPort
Main.MSComm1.Settings = strSet
Main.MSComm1.PortOpen = True
End If
If Not blnAutoSendFlag And Not blnReceiveFlag Then
Main.MSComm1.PortOpen = False
End If
config.Hide
Unload config
Exit Sub
SettingError:
intPort = 2
intTime = 1000
strSet = "9600,n,8,1"
config.Show
config.txtPort.Text = Str(intPort)
config.txtSetting.Text = strSet
config.txtTime.Text = Str(intTime)
MsgBox (Error(Err.Number))
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -