📄 frmsetting.frm
字号:
VERSION 5.00
Begin VB.Form dlgsetting
BorderStyle = 3 'Fixed Dialog
Caption = "设置参数"
ClientHeight = 3195
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6030
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 6030
ShowInTaskbar = 0 'False
Begin VB.TextBox txttime
Height = 375
Left = 2040
TabIndex = 8
Text = "1000"
Top = 1320
Width = 735
End
Begin VB.TextBox txtsetting
Height = 375
Left = 3720
TabIndex = 7
Text = "9600,n,8,1"
Top = 480
Width = 1455
End
Begin VB.TextBox txtport
Height = 375
Left = 1680
TabIndex = 6
Text = "2"
Top = 480
Width = 615
End
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 375
Left = 3360
TabIndex = 1
Top = 2400
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 375
Left = 960
TabIndex = 0
Top = 2400
Width = 1215
End
Begin VB.Label Label4
Caption = "ms发送一次"
Height = 375
Left = 2880
TabIndex = 5
Top = 1320
Width = 1095
End
Begin VB.Label Label3
Caption = "发送时间间隔:"
Height = 255
Left = 720
TabIndex = 4
Top = 1320
Width = 1335
End
Begin VB.Label Label2
Caption = "串口设置:"
Height = 255
Left = 2760
TabIndex = 3
Top = 600
Width = 1095
End
Begin VB.Label Label1
Caption = "所用串口:"
Height = 255
Left = 720
TabIndex = 2
Top = 600
Width = 975
End
End
Attribute VB_Name = "dlgsetting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'取消
'**************************************
Private Sub cmdcancel_Click()
dlgsetting.Hide
Unload dlgsetting
End Sub
'确定
'**************************************
Private Sub cmdok_Click()
On Error GoTo settingerror
intport = Val(dlgsetting.txtport.Text)
inttime = Val(dlgsetting.txttime.Text)
strset = dlgsetting.txtsetting.Text
If Not frmmain.ctrmscomm.PortOpen Then
frmmain.ctrmscomm.CommPort = intport
frmmain.ctrmscomm.Settings = strset
End If
dlgsetting.Hide
Unload dlgsetting
Exit Sub
settingerror:
intport = 2
inttime = 1000
strset = "9600,n,8,1"
dlgsetting.Show
dlgsetting.txtport.Text = Str(intport)
dlgsetting.txtsetting.Text = strset
dlgsetting.txttime.Text = Str(inttime)
Select Case Err.Number
Case 380
MsgBox ("属性设置错误")
Case 8002
MsgBox ("错误的串口号")
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -