📄 frmsettings.frm
字号:
VERSION 5.00
Begin VB.Form frmSettings
BorderStyle = 1 'Fixed Single
Caption = "Connection Properties"
ClientHeight = 2445
ClientLeft = 45
ClientTop = 330
ClientWidth = 4305
Icon = "frmSettings.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2445
ScaleWidth = 4305
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton cmdOpenPort
Caption = "Open COM Port"
Height = 345
Left = 2640
TabIndex = 6
Top = 1875
Width = 1425
End
Begin VB.Frame fraPort
Caption = "COM Port"
Height = 2055
Left = 135
TabIndex = 0
Top = 195
Width = 1410
Begin VB.OptionButton optCOM
Caption = "COM 4"
Enabled = 0 'False
Height = 240
Index = 3
Left = 270
TabIndex = 4
Top = 1545
Width = 900
End
Begin VB.OptionButton optCOM
Caption = "COM 1"
Height = 240
Index = 0
Left = 270
TabIndex = 3
Top = 465
Width = 900
End
Begin VB.OptionButton optCOM
Caption = "COM 2"
Height = 240
Index = 1
Left = 270
TabIndex = 2
Top = 825
Value = -1 'True
Width = 900
End
Begin VB.OptionButton optCOM
Caption = "COM 3"
Enabled = 0 'False
Height = 240
Index = 2
Left = 270
TabIndex = 1
Top = 1185
Width = 900
End
End
Begin VB.Label lblConnect
Caption = $"frmSettings.frx":030A
Height = 1365
Left = 1710
TabIndex = 5
Top = 270
Width = 2385
End
End
Attribute VB_Name = "frmSettings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdOpenPort_Click()
Dim n As Byte
Dim thePort As Integer
For n = 0 To 3
If optCOM(n).Value = True Then ' figure out which option box is checked...
thePort = n + 1
Exit For
End If
Next n
With frmMain.MSComm1
.CommPort = thePort
' 4800 baud, no parity, 8 data, and 1 stop bit (NMEA settings).
.Settings = "4800,N,8,1"
' Tell the control to read entire buffer when .Input is used.
.InputLen = 0
' Open the port.
.PortOpen = True
.RThreshold = 500
End With
With frmMain.tlbMain
.Buttons(5).Enabled = True
.Buttons(4).Enabled = False
.Buttons(1).Enabled = False
End With
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -