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

📄 frv.frm

📁 串口通讯。上位机实例.提供了良好的界面。对初学者很有参考性
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Height          =   255
         Left            =   120
         TabIndex        =   9
         Top             =   0
         Width           =   1515
      End
   End
   Begin VB.PictureBox Picture2 
      BorderStyle     =   0  'None
      Height          =   1095
      Left            =   360
      ScaleHeight     =   1095
      ScaleWidth      =   1875
      TabIndex        =   2
      Top             =   1500
      Width           =   1875
      Begin 电压表与电压源上位机.MorphDisplay SEG1 
         Height          =   645
         Left            =   60
         TabIndex        =   3
         Top             =   360
         Width           =   1725
         _ExtentX        =   2619
         _ExtentY        =   1138
         BackColor1      =   -2147483633
         BackColor2      =   -2147483633
         BorderWidth     =   0
         BurnInColor     =   16777215
         BurnInColorNeg  =   16777215
         NumDigits       =   4
         SegmentHeight   =   17
         SegmentLitColor =   255
         SegmentLitColorNeg=   16711680
      End
      Begin VB.Label Label2 
         Caption         =   "当前电压:V"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   60
         Width           =   1335
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   120
      Top             =   240
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   1035
      Left            =   -60
      ScaleHeight     =   1005
      ScaleWidth      =   8985
      TabIndex        =   0
      Top             =   0
      Width           =   9015
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "数字电压表控制面板"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   21.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   495
         Left            =   900
         TabIndex        =   1
         Top             =   300
         Width           =   4275
      End
      Begin VB.Image Image1 
         Appearance      =   0  'Flat
         Height          =   720
         Left            =   5340
         Picture         =   "FrV.frx":1CCA
         Top             =   180
         Width           =   720
      End
   End
   Begin VB.Label Label5 
      Caption         =   "电压波形:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   255
      Left            =   2700
      TabIndex        =   15
      Top             =   1500
      Width           =   1215
   End
End
Attribute VB_Name = "FrV"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim PicB As Boolean                        '用来轮流切换图片实现动态
Dim Tbyte As Byte                          '发送命令
Private Sub Command1_Click()
If SEG2.Value < 1 Then
    SEG2.Value = Format$(SEG2.Value + 0.01, "0.00")
    If SEG1.Value <> Format$(Null, "0.00") Then
    SEG1.Value = Format$(SEG1.Value + 0.01, "0.00")
    End If
Else
    MsgBox "已经达到上限!"
End If
End Sub
Private Sub Command2_Click()
If SEG2.Value > -1 Then
    SEG2.Value = Format$(SEG2.Value - 0.01, "0.00")
    If SEG1.Value <> Format$(Null, "0.00") Then
    SEG1.Value = Format$(SEG1.Value - 0.01, "0.00")
    End If
Else
    MsgBox "已经达到下限!"
End If
End Sub

Private Sub Command3_Click()
If HZ.Value < 200 Then
    HZ.Value = HZ.Value + 10
    If Command8.Caption = "暂停" Then  'AD工作时发送
        Call SendF
    End If
Else
    MsgBox "已经达到上限!"
End If
End Sub

Private Sub Command4_Click()
If HZ.Value > 10 Then
    HZ.Value = HZ.Value - 10
    If Command8.Caption = "暂停" Then  'AD工作时发送
        Call SendF
    End If
Else
    MsgBox "已经达到下限!"
End If
End Sub

Private Sub Command5_Click()
Dim temp As Integer
temp = MsgBox("对不起数据库尚在开发中...", vbOKOnly + vbInformation + vbDefaultButton1)
End Sub

Private Sub Command6_Click()
Unload Me
Form1.Show
End Sub
Private Sub Command7_Click()
If Command8.Caption = "暂停" Then     '若AD还在运行则停止
    Command8.Caption = "开始"
    Call StopAD
End If
Unload Form1                          '卸载主窗口
Unload Me
End Sub

Private Sub Command8_Click()
Static CmdSta As Boolean
If Not CmdSta Then                                '暂停
    Call StopAD
    CmdSta = True
    Command8.Caption = "开始"
   SEG1.Value = Format$(Null, "0.00")          'SEG复位
Else                                          '打开
    Call StartAD
    CmdSta = False
    Command8.Caption = "暂停"
End If
End Sub

Private Sub Form_Load()
'----------------Initialize Parameter-------------------------
'Call FrmDisCtr(FrV)
Timer1.Enabled = True
PicB = True
SEG1.Value = Format$(Null, "0.00")           '设置三个SEG的初始值
SEG2.Value = Format$(0, "0.00")           '
HZ.Value = 10                             '
'RecNum = 0                                '初始化接收个数
With StatusBar1.Panels
    .Item(1).Text = "打开串口:" & OpenPort
    .Item(2).Text = "设置:" & PortSet
'   .Item(3).Text = "接收数据:" & RecNum
    .Item(5).Text = "Power By Sphinx 2008.5"
End With
Call StartAD
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Command8.Caption = "暂停" Then     '若AD还在运行则停止
    Call StopAD
End If
Unload Form1                          '卸载主窗口
End Sub

Private Sub Timer1_Timer()
If PicB Then
   Call Path("Pic/48vr.ico")
   Image1.Picture = LoadPicture(FullPath)
    'Image1.Picture = LoadPicture(".\Pic\48vr.ico")
    PicB = False
Else
    Call Path("Pic/48vb.ico")
    Image1.Picture = LoadPicture(FullPath)
    'Image1.Picture = LoadPicture(".\Pic\48vb.ico")
    PicB = True
End If
End Sub

⌨️ 快捷键说明

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