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

📄 frmmain.frm

📁 Led识别与统计系统,基于DELPHI 7.0下
💻 FRM
字号:
VERSION 5.00
Object = "{E78F5C3E-6F52-4ED9-9F1F-2EE79BF42B2B}#1.0#0"; "HVDevice.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmMain 
   Caption         =   "HVDevice Ocx Test"
   ClientHeight    =   8025
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   9300
   LinkTopic       =   "Form1"
   ScaleHeight     =   535
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   620
   StartUpPosition =   3  'Windows Default
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   8400
      Top             =   2160
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      Filter          =   "bmp"
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   1
      Top             =   7650
      Width           =   9300
      _ExtentX        =   16404
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            AutoSize        =   1
            Object.Width           =   10583
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   5292
            MinWidth        =   5292
         EndProperty
      EndProperty
   End
   Begin HVDEVICELib.HVDevice HVDevice 
      Height          =   7695
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   8055
      _Version        =   65536
      _ExtentX        =   14208
      _ExtentY        =   13573
      _StockProps     =   169
      ForeColor       =   255
      BackColor       =   16777215
      Appearance      =   1
      Resolution      =   1
      ADCLevel        =   3
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   8400
      Top             =   5400
   End
   Begin VB.Menu File 
      Caption         =   "File"
      Begin VB.Menu FileSave 
         Caption         =   "Save Image..."
      End
      Begin VB.Menu FileExit 
         Caption         =   "Exit"
      End
   End
   Begin VB.Menu Device 
      Caption         =   "Device"
      Begin VB.Menu SingleGrab 
         Caption         =   "Single Grab"
      End
      Begin VB.Menu ContinuousGrab 
         Caption         =   "Continuous Grab"
      End
      Begin VB.Menu CancelGrab 
         Caption         =   "Cancel Grab"
      End
      Begin VB.Menu AutoWhiteBalance 
         Caption         =   "Auto White Balance"
      End
      Begin VB.Menu Properties 
         Caption         =   "Properties"
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fContinuousGrabActive As Boolean

Private Sub AutoWhiteBalance_Click()
    HVDevice.AutoWhiteBalance
    Timer1.Enabled = True
End Sub

Private Sub CancelGrab_Click()
    HVDevice.GrabCancel
    fContinuousGrabActive = False
    Timer1.Enabled = False
End Sub

Private Sub ContinuousGrab_Click()
    HVDevice.GrabContinuous
    fContinuousGrabActive = True
    Timer1.Enabled = True
End Sub


Private Sub FileExit_Click()
    Unload frmMain
End Sub


Private Sub FileSave_Click()
    On Error GoTo ExitNow
    
    CommonDialog1.Filter = "Bmp files|*.bmp|Jpeg files|*.jpg"
    CommonDialog1.FilterIndex = 1
    CommonDialog1.DefaultExt = "bmp"
    CommonDialog1.Flags = cdlOFNHideReadOnly Or cdlOFNPathMustExist Or _
        cdlOFNOverwritePrompt Or cdlOFNNoReadOnlyReturn
    CommonDialog1.DialogTitle = "Select the destination file "
    ' Exit if user presses Cancel.
    CommonDialog1.CancelError = True
    CommonDialog1.ShowSave
    
    HVDevice.SaveImage CommonDialog1.FileName
    
ExitNow:
    
End Sub

Private Sub Form_Load()
    fContinuousGrabActive = False
    frmMain.ScaleMode = 3
End Sub

Private Sub Form_Resize()
    HVDevice.Left = 0
    HVDevice.Top = 0
    HVDevice.Width = frmMain.ScaleWidth
    HVDevice.Height = frmMain.ScaleHeight
End Sub


Private Sub Form_Unload(Cancel As Integer)
    If fContinuousGrabActive Then
        HVDevice.GrabCancel
        Timer1.Enabled = False
    End If
End Sub

Private Sub HVDevice_GrabContinuousChange()
    HVDevice.Draw 0, 0, HVDevice.Width, HVDevice.Height, 0, 0, HVDevice.Width, HVDevice.Height
    HVDevice.Continue
End Sub


Private Sub Properties_Click()
    frmProperties.Show vbModal
End Sub

Private Sub SingleGrab_Click()
    Dim status As Integer
    HVDevice.GrabSingle
    HVDevice.Draw 0, 0, HVDevice.Width, HVDevice.Height, _
        0, 0, HVDevice.Width, HVDevice.Height
End Sub

Private Sub Timer1_Timer()
   StatusBar1.Panels(2).Text = "FPS-displayed:" + CStr(HVDevice.GetFrameRate)
   
End Sub

⌨️ 快捷键说明

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