⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form5.frm

📁 串口调试程序(vb)版本
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form5 
   Caption         =   "串口数据绘图"
   ClientHeight    =   7365
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8865
   LinkTopic       =   "Form5"
   ScaleHeight     =   7365
   ScaleWidth      =   8865
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog Diag1 
      Left            =   3000
      Top             =   1800
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      DefaultExt      =   "*.bmp"
      DialogTitle     =   "保存图像"
      FileName        =   "pic"
   End
   Begin VB.CommandButton Command2 
      Caption         =   "SavePicture"
      Height          =   495
      Left            =   6840
      TabIndex        =   4
      Top             =   1320
      Width           =   1215
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      Height          =   4695
      Left            =   120
      ScaleHeight     =   4635
      ScaleWidth      =   8595
      TabIndex        =   3
      Top             =   2520
      Width           =   8655
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2295
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   2
      Top             =   135
      Width           =   2655
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2295
      Left            =   3720
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   120
      Width           =   2535
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Start"
      Height          =   495
      Left            =   6825
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   100
      Left            =   3000
      Top             =   360
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   3000
      Top             =   945
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      CommPort        =   2
      DTREnable       =   -1  'True
      RThreshold      =   1
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
 Picture1.Cls
 Call Form_Load
 If Not Timer1.Enabled Then
    Command1.Caption = "End"
 Else
    Command1.Caption = "Start"
 End If
 Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Command2_Click()
   Timer1.Enabled = False
   Diag1.InitDir = App.Path
   Diag1.Filter = "图形文件(*.bmp)|*.bmp|jpeg|*.jpg"
   Diag1.ShowSave
   MsgBox Diag1.FileTitle
   If Diag1.FileName <> "" Then
        SavePicture Picture1.Image, Diag1.FileName  ' "d:\123.bmp"
   End If
End Sub
Private Sub Form_Load()
  If Not MSComm1.PortOpen Then
     MSComm1.PortOpen = True
  End If
   Picture1.Scale (-5, 200)-(245, -100)
   Picture1.Line (-5, 0)-(245, 0), vbBlue
   Picture1.Line (0, 200)-(0, -100), vbBlue
   Picture1.Line (-3, 190)-(0, 200), vbBlue
   Picture1.Line (3, 190)-(0, 200), vbBlue
   Picture1.DrawWidth = 2
   Picture1.CurrentX = 0
   Picture1.CurrentY = 0
End Sub
Private Sub MSComm1_OnComm()
   Select Case MSComm1.CommEvent
        Case comEvReceive   ' 收到 RThreshold
             Text2.Text = MSComm1.Input
             Static t As Integer
             t = t + 1
             Picture1.Line -(t, Val(Text2.Text)), vbRed
    End Select
End Sub
Private Sub Timer1_Timer()
    Randomize (Now)
    Text1.Text = Int(Rnd * 100)
    MSComm1.Output = Text1.Text
End Sub

⌨️ 快捷键说明

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