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

📄 mainform.frm

📁 《AVR单片机GCC程序设计》
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form MainForm 
   BackColor       =   &H00FFC0C0&
   Caption         =   "PrintMonitor V1.0 [COM1,9600,8,1]"
   ClientHeight    =   4170
   ClientLeft      =   4635
   ClientTop       =   4740
   ClientWidth     =   6165
   DrawMode        =   14  'Copy Pen
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   278
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   411
   Begin VB.Timer Timer1 
      Interval        =   50
      Left            =   1320
      Top             =   3240
   End
   Begin VB.TextBox Text2 
      Height          =   300
      Left            =   120
      TabIndex        =   3
      Top             =   2760
      Width           =   3495
   End
   Begin VB.CommandButton Clear 
      Caption         =   "Clear"
      Height          =   300
      Left            =   4920
      TabIndex        =   2
      Top             =   2760
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H80000018&
      Height          =   2535
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   120
      Width           =   5895
   End
   Begin VB.CommandButton Send 
      Caption         =   "Send"
      Default         =   -1  'True
      Height          =   300
      Left            =   3720
      TabIndex        =   0
      Top             =   2760
      Width           =   1095
   End
   Begin MSCommLib.MSComm MSComm 
      Left            =   1920
      Top             =   3240
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

'Print Monitor V1.0
'串行口字符(串)收发程序
'编译:Visual Basic 6.0

'作者:芯艺  2004-03
'e_mail:changfutong@sina.com    OICQ:27796915
'web: http://bitfu.zj.com       http://bitfu.yeah.net

Private Sub Clear_Click()
    Text1.Text = vbNullString
End Sub

Private Sub Form_Load()
    
    MSComm.CommPort = 1
    MSComm.Settings = "9600, N, 8, 1"
                                             
    MSComm.RThreshold = 0                   '产生 OnComm 事件之前要接收的字符数
    MSComm.InputLen = 0                     '一次可读取的长度(0,读所有)
    MSComm.InputMode = comInputModeText     '文本格式读取
    MSComm.PortOpen = True
End Sub

Private Sub Form_Resize()
    If Me.ScaleHeight < 200 Then Exit Sub
    If Me.ScaleWidth < 400 Then Exit Sub
    
    Text1.Left = 2
    Text1.Width = Me.ScaleWidth - 4
    Text1.Top = 2
    
    Text2.Height = 20
    Send.Height = 20
    Clear.Height = 20
    
    Text1.Height = Me.ScaleHeight - Text2.Height - 6
 
    Text2.Top = Text1.Height + 4
    Text2.Left = Text1.Left
    
    Clear.Top = Text2.Top
    Send.Top = Text2.Top
    
    Clear.Left = Me.ScaleWidth - 2 - Clear.Width
    Send.Left = Clear.Left - 2 - Send.Width
    Text2.Width = Me.ScaleWidth - (Me.ScaleWidth - Send.Left) - 4
       
End Sub

Private Sub Form_Unload(Cancel As Integer)
   If MSComm.PortOpen Then MSComm.PortOpen = False
End Sub

Private Sub Send_Click()
    If Text2.Text <> vbNullString Then
        MSComm.Output = Text2.Text
        Text1.Text = Text1.Text + ">:" + Text2.Text + Chr(13) + Chr(10)
        Text2.Text = vbNullString
        MSComm.Output = Chr(10)
    End If
    
End Sub

Private Sub Timer1_Timer()
    Dim v As String
    v = MSComm.Input
    If Len(v) > 0 Then Text1.Text = Text1.Text + v
End Sub

⌨️ 快捷键说明

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