form2.frm

来自「双机的串口通讯」· FRM 代码 · 共 192 行

FRM
192
字号
VERSION 5.00
Begin VB.Form Form2 
   Caption         =   "设置"
   ClientHeight    =   4140
   ClientLeft      =   7005
   ClientTop       =   5475
   ClientWidth     =   5175
   LinkTopic       =   "Form2"
   ScaleHeight     =   4140
   ScaleWidth      =   5175
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2880
      TabIndex        =   14
      Top             =   3600
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   960
      TabIndex        =   7
      Top             =   3600
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "Frame1"
      Height          =   3375
      Left            =   600
      TabIndex        =   0
      Top             =   120
      Width           =   3855
      Begin VB.CheckBox Check1 
         Caption         =   "Check1"
         Height          =   255
         Left            =   360
         TabIndex        =   13
         Top             =   2520
         Width           =   255
      End
      Begin VB.ComboBox Combo5 
         Height          =   315
         ItemData        =   "Form2.frx":0000
         Left            =   1320
         List            =   "Form2.frx":0013
         TabIndex        =   12
         Top             =   2880
         Width           =   2055
      End
      Begin VB.ComboBox Combo4 
         Height          =   315
         ItemData        =   "Form2.frx":0036
         Left            =   1320
         List            =   "Form2.frx":0043
         TabIndex        =   11
         Top             =   2040
         Width           =   2055
      End
      Begin VB.ComboBox Combo3 
         Height          =   315
         ItemData        =   "Form2.frx":0052
         Left            =   1320
         List            =   "Form2.frx":0062
         TabIndex        =   10
         Top             =   1440
         Width           =   2055
      End
      Begin VB.ComboBox Combo2 
         Height          =   315
         ItemData        =   "Form2.frx":0072
         Left            =   1320
         List            =   "Form2.frx":0085
         TabIndex        =   9
         Top             =   960
         Width           =   2055
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         ItemData        =   "Form2.frx":00A8
         Left            =   1320
         List            =   "Form2.frx":00B8
         TabIndex        =   8
         Top             =   360
         Width           =   2055
      End
      Begin VB.Label Label1 
         Caption         =   "校验方式"
         Height          =   255
         Index           =   5
         Left            =   240
         TabIndex        =   6
         Top             =   2880
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "进行校验"
         Height          =   255
         Index           =   4
         Left            =   720
         TabIndex        =   5
         Top             =   2520
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "停止位"
         Height          =   255
         Index           =   3
         Left            =   240
         TabIndex        =   4
         Top             =   2040
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "位长"
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   3
         Top             =   1440
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "波特率"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   2
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "串口"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   615
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Check1_Click()

Select Case Check1.Value
       Case 0
          Form2.Combo5.Enabled = False
          Form1.MSComm1.Settings = intBaudRate + "," + n + "," + intBytesize + "," + intStopBits
       Case 1
        Form2.Combo5.Enabled = True
        Form1.MSComm1.Settings = intBaudRate + "," + intJiaoYan + "," + intBytesize + "," + intStopBits
  End Select

End Sub

Private Sub Command1_Click()
 
    intBaudRate = Form2.Combo2.Text
    intBytesize = Form2.Combo3.Text
    intStopBits = Form2.Combo4.Text
    intJiaoYan = Form2.Combo5.Text
   
   intComPort = Form2.Combo1.ListIndex + 1
   
  If Form1.MSComm1.PortOpen = True Then
     Form1.MSComm1.PortOpen = False
  End If
    
     Form1.MSComm1.CommPort = intComPort
      
    
   Form2.Hide
   Unload Form2
  
End Sub

Private Sub Command2_Click()

    Form2.Hide
    Unload Form2

End Sub


    

⌨️ 快捷键说明

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