📄 frmsetting.frm
字号:
VERSION 5.00
Begin VB.Form frmSetting
Caption = "参数设定"
ClientHeight = 4800
ClientLeft = 60
ClientTop = 345
ClientWidth = 4575
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4800
ScaleWidth = 4575
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 3120
TabIndex = 13
Top = 4320
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 120
TabIndex = 12
Top = 4320
Width = 1335
End
Begin VB.Frame Frame1
Caption = "参数内容"
Height = 3975
Left = 120
TabIndex = 0
Top = 120
Width = 4335
Begin VB.TextBox txtEnd
Height = 300
Left = 2040
TabIndex = 14
Top = 3360
Width = 1935
End
Begin VB.ComboBox Combo5
Height = 300
Left = 2040
Style = 2 'Dropdown List
TabIndex = 5
Top = 2760
Width = 1935
End
Begin VB.ComboBox Combo4
Height = 300
Left = 2040
Style = 2 'Dropdown List
TabIndex = 4
Top = 2160
Width = 1935
End
Begin VB.ComboBox Combo3
Height = 300
Left = 2040
Style = 2 'Dropdown List
TabIndex = 3
Top = 1560
Width = 1935
End
Begin VB.ComboBox Combo2
Height = 300
Left = 2040
Style = 2 'Dropdown List
TabIndex = 2
Top = 960
Width = 1935
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2040
Style = 2 'Dropdown List
TabIndex = 1
Top = 360
Width = 1935
End
Begin VB.Label Label8
Caption = "结束字符(16进制):"
Height = 255
Left = 360
TabIndex = 11
Top = 3480
Width = 1575
End
Begin VB.Label Label7
Caption = "停止位:"
Height = 255
Left = 360
TabIndex = 10
Top = 2880
Width = 1215
End
Begin VB.Label Label5
Caption = "数据位:"
Height = 255
Left = 360
TabIndex = 9
Top = 2280
Width = 1215
End
Begin VB.Label Label3
Caption = "奇偶校验:"
Height = 255
Left = 360
TabIndex = 8
Top = 1680
Width = 1215
End
Begin VB.Label Label2
Caption = "波特率:"
Height = 255
Left = 360
TabIndex = 7
Top = 1080
Width = 1335
End
Begin VB.Label Label1
Caption = "所用串囗:"
Height = 255
Left = 360
TabIndex = 6
Top = 480
Width = 1335
End
End
End
Attribute VB_Name = "frmSetting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo settingerr
If txtEnd.Text = "" Then
MsgBox "内容不完整!", vbOKOnly, "警告"
If txtEnd.Text = "" Then
txtEnd.SetFocus
End If
'If txtTime.Text = "" Then
' txtTime.SetFocus
'End If
Exit Sub
End If
intPort = CInt(Trim(Combo1.Text))
strSet = Trim(Combo2.Text) & "," & Left(Trim(Combo3.Text), 1) & "," & Trim(Combo4.Text) & "," & Trim(Combo5.Text)
'intTime = CInt(Trim(txtTime.Text))
strEnd = Trim(txtEnd.Text)
'MsgBox intPort & strSet & intTime & strEnd
If Not frmMain.MSComm.PortOpen Then
frmMain.MSComm.CommPort = intPort
frmMain.MSComm.Settings = strSet
frmMain.MSComm.PortOpen = True
End If
Me.Hide
Unload Me
Exit Sub
settingerr:
intPort = 1
strSet = "9600,N,8,1"
Me.Hide
Unload Me
End Sub
Private Sub Command2_Click()
Me.Hide
Unload Me
End Sub
Private Sub Form_Load()
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
Combo1.AddItem "4"
Combo1.Text = "1"
Combo2.AddItem "110"
Combo2.AddItem "300"
Combo2.AddItem "600"
Combo2.AddItem "1200"
Combo2.AddItem "2400"
Combo2.AddItem "9600"
Combo2.AddItem "14400"
Combo2.AddItem "19200"
Combo2.Text = "9600"
Combo3.AddItem "E(奇校验)"
Combo3.AddItem "O(偶校验)"
Combo3.AddItem "N(不校验)"
Combo3.Text = "N(不校验)"
Combo4.AddItem "4"
Combo4.AddItem "5"
Combo4.AddItem "6"
Combo4.AddItem "7"
Combo4.AddItem "8"
Combo4.Text = "8"
Combo5.AddItem "1"
Combo5.AddItem "1.5"
Combo5.AddItem "2"
Combo5.Text = "1"
txtEnd.Text = "1a"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Command2_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -