comset.frm

来自「这是vb用控件的写的串口程序」· FRM 代码 · 共 84 行

FRM
84
字号
VERSION 5.00
Begin VB.Form comset 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "串口设置"
   ClientHeight    =   1680
   ClientLeft      =   45
   ClientTop       =   345
   ClientWidth     =   4155
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1680
   ScaleWidth      =   4155
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "取     消"
      Height          =   375
      Left            =   2280
      TabIndex        =   4
      Top             =   1080
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确     认"
      Height          =   375
      Left            =   2280
      TabIndex        =   3
      Top             =   240
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "串口号"
      Height          =   1335
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1695
      Begin VB.OptionButton Option2 
         Caption         =   " COM2"
         Height          =   375
         Left            =   360
         TabIndex        =   2
         Top             =   840
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   " COM1"
         Height          =   375
         Left            =   360
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "comset"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
main.MSComm1.PortOpen = False
If Me.Option1.Value Then
    main.MSComm1.CommPort = 1
Else
    main.MSComm1.CommPort = 2
End If
main.MSComm1.PortOpen = True
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
If main.MSComm1.CommPort = 1 Then
    Me.Option1.Value = True
Else
    Me.Option2.Value = True
End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?