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

📄 frmfind.frm

📁 用vb编程实现对交通拍照的交通控制管理
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form frmfind 
   Caption         =   "查询记录"
   ClientHeight    =   8820
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12195
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmfind.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8820
   ScaleWidth      =   12195
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.CommandButton cmdReset 
      Caption         =   "清空"
      Height          =   420
      Left            =   5136
      TabIndex        =   8
      ToolTipText     =   "清空查询条件"
      Top             =   1578
      Width           =   1044
   End
   Begin VB.CommandButton cmdSearch 
      Caption         =   "搜索"
      Default         =   -1  'True
      Height          =   420
      Left            =   5136
      TabIndex        =   6
      ToolTipText     =   "搜索符合条件记录"
      Top             =   156
      Width           =   1044
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "退出"
      Height          =   420
      Left            =   5136
      TabIndex        =   7
      ToolTipText     =   "退出查询"
      Top             =   867
      Width           =   1044
   End
   Begin VB.CommandButton cmdModi 
      Caption         =   "修改..."
      Enabled         =   0   'False
      Height          =   420
      Left            =   5136
      TabIndex        =   9
      ToolTipText     =   "修改当前记录内容"
      Top             =   2289
      Width           =   1044
   End
   Begin VB.Frame famSearch 
      Caption         =   "确定查询条件"
      Height          =   3432
      Left            =   108
      TabIndex        =   11
      Top             =   36
      Width           =   4920
      Begin VB.Frame Frame1 
         Caption         =   "违章时间"
         Height          =   1140
         Left            =   144
         TabIndex        =   15
         Top             =   2064
         Width           =   4596
         Begin VB.ComboBox cboTime 
            Height          =   312
            ItemData        =   "frmfind.frx":030A
            Left            =   132
            List            =   "frmfind.frx":031A
            Style           =   2  'Dropdown List
            TabIndex        =   3
            Top             =   324
            Width           =   768
         End
         Begin MSMask.MaskEdBox txtDate 
            Height          =   324
            Index           =   0
            Left            =   1152
            TabIndex        =   4
            Top             =   324
            Width           =   3156
            _ExtentX        =   5556
            _ExtentY        =   556
            _Version        =   393216
            MaxLength       =   11
            Mask            =   "####年##月##日"
            PromptChar      =   "_"
         End
         Begin MSMask.MaskEdBox txtDate 
            Height          =   324
            Index           =   1
            Left            =   1152
            TabIndex        =   5
            Top             =   708
            Visible         =   0   'False
            Width           =   3156
            _ExtentX        =   5556
            _ExtentY        =   582
            _Version        =   393216
            MaxLength       =   11
            Mask            =   "####年##月##日"
            PromptChar      =   "_"
         End
         Begin VB.Label labReach 
            AutoSize        =   -1  'True
            Caption         =   "到"
            Height          =   216
            Left            =   684
            TabIndex        =   16
            Top             =   768
            Visible         =   0   'False
            Width           =   216
         End
      End
      Begin VB.ComboBox cboPostName 
         Height          =   312
         Left            =   1308
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   1596
         Width           =   3444
      End
      Begin VB.TextBox txtCarNumber 
         Height          =   336
         Left            =   1308
         TabIndex        =   0
         Top             =   432
         Width           =   3444
      End
      Begin VB.TextBox txtCarMan 
         Height          =   336
         Left            =   1308
         TabIndex        =   1
         Top             =   1020
         Width           =   3444
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "车牌号码:"
         Height          =   216
         Left            =   180
         TabIndex        =   14
         Top             =   432
         Width           =   1056
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "违章地点:"
         Height          =   216
         Left            =   180
         TabIndex        =   13
         Top             =   1596
         Width           =   1080
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "车主:"
         Height          =   210
         Left            =   180
         TabIndex        =   12
         Top             =   1020
         Width           =   630
      End
   End
   Begin MSComctlLib.StatusBar stdBar 
      Align           =   2  'Align Bottom
      Height          =   372
      Left            =   0
      TabIndex        =   10
      Top             =   8448
      Width           =   12192
      _ExtentX        =   21511
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            AutoSize        =   2
            Object.ToolTipText     =   "查询结果"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ListView lstViwCapture 
      Height          =   756
      Left            =   204
      TabIndex        =   17
      Top             =   4548
      Width           =   1500
      _ExtentX        =   2646
      _ExtentY        =   1349
      LabelEdit       =   1
      LabelWrap       =   0   'False
      HideSelection   =   0   'False
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.Image Image1 
      BorderStyle     =   1  'Fixed Single
      Height          =   4452
      Left            =   6636
      Top             =   84
      Width           =   7368
   End
End
Attribute VB_Name = "frmfind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cboTime_Click()
    If cboTime.Text = "" Then
        txtDate(0).Text = "____年__月__日"
        txtDate(0).Enabled = False
        labReach.Visible = False
        txtDate(1).Visible = False
    ElseIf cboTime.Text = "从" Then
        txtDate(0).Enabled = True
        labReach.Visible = True
        txtDate(1).Visible = True
    Else
        txtDate(0).Enabled = True
        labReach.Visible = False
        txtDate(1).Visible = False
    End If
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdModi_Click()
    g_lCurRecID = lstViwCapture.SelectedItem.Tag
    frmModiy.Show vbModal
End Sub



Private Sub cmdSearch_Click()
Dim sSql As String

    txtCarNumber.Text = Trim(txtCarNumber.Text)
    txtCarMan.Text = Trim(txtCarMan.Text)
    
    '查找所有记录
    sSql = "Select * from tabCaptureRec where fldID > 0"
    
    If txtCarNumber.Text <> "" Then
        sSql = sSql & " and fldCarNumber = '" & txtCarNumber.Text & "'"
    End If
    If txtCarMan.Text <> "" Then
        sSql = sSql & " and (fldCarMan = '" & txtCarMan.Text & "' or fldMotorMan = '" & txtCarMan.Text & "')"
    End If
    If cboPostName.ListIndex <> 0 Then
        sSql = sSql & " and fldPostName = '" & Format(cboPostName.Text) & "'"
    End If
    
    If txtDate(0).Text <> "____年__月__日" Then
        If IsDate(txtDate(0).Text) = False Then
            MsgBox "日期输入错误,请输入正确日期或空日期", , "输入错误"
            txtDate(0).SetFocus
            Exit Sub
        End If
    End If
    
    If cboTime.Text = "从" And txtDate(0).Text <> "____年__月__日" Then
        If IsDate(txtDate(1).Text) = False Then
            MsgBox "日期输入错误,请输入正确日期或空日期", , "输入错误"
            txtDate(1).SetFocus
            Exit Sub
        Else
            sSql = sSql & " and fldCapDate >= #" & CDate(txtDate(0).Text) & "# and fldCapDate <= #" & CDate(txtDate(1).Text) & "#"
        End If
    ElseIf txtDate(0).Text <> "____年__月__日" Then
        sSql = sSql & " and fldCapDate " & cboTime.Text & " #" & CDate(txtDate(0).Text) & "#"
    End If
    
Dim rs As Recordset, itemX As ListItem

    lstViwCapture.ListItems.Clear
    Set rs = g_myDB.OpenRecordset(sSql, dbOpenSnapshot)
    Do While Not rs.EOF
        Set itemX = lstViwCapture.ListItems.Add(, , Format(rs!fldCarNumber))
        itemX.SubItems(1) = Format(rs!fldCarMan)
        itemX.SubItems(2) = Format(rs!fldMotorMan)
        itemX.SubItems(3) = Format(rs!fldCarStyle)
        itemX.SubItems(4) = Format(rs!fldPostName)
        itemX.SubItems(5) = Format(rs!fldDirection)
        itemX.SubItems(6) = Format(rs!fldCapDate, "Long Date") & Format(rs!fldCapTime, "Long Time")
        itemX.SubItems(7) = Format(rs!fldJpgFile)
        itemX.SubItems(8) = Format(rs!fldPrintID)
        itemX.SubItems(9) = Format(rs!fldReson)
        itemX.Tag = rs!fldID
        
        rs.MoveNext
    Loop
    rs.Close
    
    stdBar.Panels(1).Text = "当前查询结果,总计: " & Format(lstViwCapture.ListItems.Count) & " 条记录"
    If lstViwCapture.ListItems.Count > 0 Then
        cmdModi.Enabled = True
        
        Call lstViwCapture_ItemClick(lstViwCapture.ListItems(1))
    Else
        cmdModi.Enabled = False
       
        Image1.Picture = LoadPicture("")
    End If
End Sub

Private Sub cmdReset_Click()
    txtCarNumber.Text = ""
    txtCarMan.Text = ""
    cboPostName.ListIndex = 0
    cboTime.ListIndex = 0
    lstViwCapture.ListItems.Clear
    stdBar.Panels(1).Text = "当前查询结果,总计: " & Format(lstViwCapture.ListItems.Count) & " 条记录"
End Sub

Private Sub Form_Load()
    Call InitCbo
    Call InitLst
End Sub

Private Sub Form_Resize()
    
    famSearch.Left = 2 * Screen.TwipsPerPixelX
    
    Image1.Width = 498 * Screen.TwipsPerPixelX
    Image1.Height = 288 * Screen.TwipsPerPixelY
    Image1.Left = Me.ScaleWidth - Image1.Width - 2 * Screen.TwipsPerPixelX
    Image1.Top = 3 * Screen.TwipsPerPixelY 'Picture1.Top + Picture1.Height + 60 * Screen.TwipsPerPixelY
    
    lstViwCapture.Left = famSearch.Left
    lstViwCapture.Top = Image1.Top + Image1.Height + 6 * Screen.TwipsPerPixelY
    lstViwCapture.Width = Me.ScaleWidth - 2 * lstViwCapture.Left
    lstViwCapture.Height = Me.ScaleHeight - lstViwCapture.Top - stdBar.Height - 1 * Screen.TwipsPerPixelY
    
End Sub

Private Sub lstViwCapture_ItemClick(ByVal Item As MSComctlLib.ListItem)
    On Error Resume Next
    Image1.Picture = LoadPicture(GetAppPath & "Jpg\" & Item.SubItems(7))
    Set lstViwCapture.SelectedItem = Item
End Sub

'初始化可选违章地点
Private Sub InitCbo()
Dim rs As Recordset
    
    cboPostName.AddItem "所有地点"
    
    Set rs = g_myDB.OpenRecordset("tabPostSettings", dbOpenSnapshot)
    Do While Not rs.EOF
        cboPostName.AddItem rs!fldPostName
        rs.MoveNext
    Loop
    rs.Close
        
    cboPostName.ListIndex = 0
    cboTime.ListIndex = 0
End Sub

'查询结果列表
Private Sub InitLst()

    lstViwCapture.View = lvwReport
    lstViwCapture.ColumnHeaders.Add , , "车牌号码", 1050
    lstViwCapture.ColumnHeaders.Add , , "      车    主", 2200
    lstViwCapture.ColumnHeaders.Add , , "姓    名", 1100
    lstViwCapture.ColumnHeaders.Add , , "车    型", 1100
    lstViwCapture.ColumnHeaders.Add , , "违章地点", 3000
    lstViwCapture.ColumnHeaders.Add , , "行驶方向", 1500
    lstViwCapture.ColumnHeaders.Add , , "违章时间", 2200
    lstViwCapture.ColumnHeaders.Add , , "图片名称", 0
    lstViwCapture.ColumnHeaders.Add , , "打印编号", 0
    lstViwCapture.ColumnHeaders.Add , , "违章原因", 0
End Sub

⌨️ 快捷键说明

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