- VERSION 5.00
- Object = "{6BF52A50-394A-11D3-B153-00C04F79FAA6}#1.0#0"; "wmp.dll"
- Begin VB.Form frmShow
- AutoRedraw = -1 'True
- BorderStyle = 1 'Fixed Single
- Caption = "回放"
- ClientHeight = 5070
- ClientLeft = 150
- ClientTop = 540
- ClientWidth = 7740
- BeginProperty Font
- Name = "Arial"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5070
- ScaleWidth = 7740
- StartUpPosition = 1 '所有者中心
- Begin VB.CommandButton cmdDelete
- Caption = "删除"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 1560
- TabIndex = 2
- ToolTipText = "Delete current picture"
- Top = 4200
- Width = 1215
- End
- Begin VB.CommandButton cmdDeleteAll
- Caption = "删除所有"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 2880
- TabIndex = 3
- ToolTipText = "Delete all pictures"
- Top = 4200
- Width = 1215
- End
- Begin VB.ComboBox cmbType
- Height = 330
- Left = 120
- Style = 2 'Dropdown List
- TabIndex = 0
- Top = 240
- Width = 2775
- End
- Begin VB.Timer timer1
- Enabled = 0 'False
- Interval = 1000
- Left = 4800
- Top = 4320
- End
- Begin VB.CommandButton cmdPlay
- Caption = "循环图片"
- Height = 495
- Left = 240
- TabIndex = 1
- ToolTipText = "Cycle through pictures"
- Top = 4200
- Width = 1215
- End
- Begin VB.CommandButton cmdClose
- Caption = "关闭"
- Default = -1 'True
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 6120
- TabIndex = 5
- ToolTipText = "Close detection log"
- Top = 4200
- Width = 1215
- End
- Begin VB.PictureBox pic1
- AutoRedraw = -1 'True
- AutoSize = -1 'True
- BackColor = &H80000005&
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 3600
- Left = 3120
- ScaleHeight = 3540
- ScaleWidth = 4260
- TabIndex = 6
- TabStop = 0 'False
- ToolTipText = "Preview of picture"
- Top = 240
- Width = 4320
- End
- Begin VB.FileListBox filShow
- Height = 3030
- Left = 120
- Pattern = "motion_*.bmp"
- TabIndex = 4
- Top = 720
- Width = 2895
- End
- Begin WMPLibCtl.WindowsMediaPlayer wmp1
- Height = 3615
- Left = 3120
- TabIndex = 7
- Top = 240
- Width = 3735
- URL = ""
- rate = 1
- balance = 0
- currentPosition = 0
- defaultFrame = ""
- playCount = 1
- autoStart = -1 'True
- currentMarker = 0
- invokeURLs = -1 'True
- baseURL = ""
- volume = 50
- mute = 0 'False
- uiMode = "full"
- stretchToFit = 0 'False
- windowlessVideo = 0 'False
- enabled = -1 'True
- enableContextMenu= -1 'True
- fullScreen = 0 'False
- SAMIStyle = ""
- SAMILang = ""
- SAMIFilename = ""
- captioningID = ""
- enableErrorDialogs= 0 'False
- _cx = 6588
- _cy = 6376
- End
- End
- Attribute VB_Name = "frmShow"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmbType_Click()
- Select Case cmbType.ListIndex '判断选中哪个类型
- Case 0 '查看图片
- filShow.Pattern = "*.BMP" '设置过滤类型为BMP
- Case 1 '查看视频
- filShow.Pattern = "*.AVI" '设置过滤类型为AVI
- End Select
- RefreshList '调用过程刷新文件列表
- End Sub
- Private Sub cmdClose_Click() '关闭
- wmp1.Close '关闭MediaPlayer控件
- Unload Me '卸载窗体
- End Sub
- Private Sub cmdDelete_Click() '删除
- Dim intReply As Integer
- intReply = MsgBox("确定想要删除 " & CStr(filShow.FileName) & "?", _
- vbExclamation + vbYesNo, "警告") '确认删除文件
- If intReply = vbYes Then
- Kill filShow.Path & "" & filShow.FileName '执行删除操作
- End If
- RefreshList '调用过程刷新文件列表
- End Sub
- Private Sub cmdDeleteAll_Click() '删除所有
- Dim intReply As Integer
- Dim i As Integer
- intReply = MsgBox("确定想要全部删除所有文件?", vbExclamation + vbYesNo, "删除警告") '确认删除
- If intReply = vbYes Then
- filShow.Refresh '刷新文件列表
- For i = 0 To filShow.ListCount - 1 '循环处理列表中的每个文件
- filShow.ListIndex = 0 '选中第1个文件
- Kill filShow.Path & "" & filShow.FileName '删除文件
- filShow.Refresh '新刷文件列表
- Next
- End If
- RefreshList '调用过程刷新文件列表
- End Sub
- Private Sub cmdPlay_Click() '循环显示图片
- If cmdPlay.Caption = "循环图片" Then '标题为“循环图片”
- timer1.Enabled = True '允许计时器
- cmdPlay.Caption = "停止循环" '修改按钮标题
- cmdPlay.ToolTipText = "停止循环图片" '修改按钮提示
- Else
- timer1.Enabled = False '禁止计时器
- cmdPlay.Caption = "循环图片" '修改按钮标题
- cmdPlay.ToolTipText = "循环图片" '修改按钮提示
- End If
- End Sub
- Private Sub filShow_Click() '单击列表框中的文件
- Dim strFile As String
- strFile = filShow.Path & "" & filShow.FileName '获取文件全路径名称
- If cmbType.ListIndex = 0 Then '显示图片
- pic1.PaintPicture LoadPicture(strFile), 0, 0, pic1.Width, pic1.Height '绘制图片
- ElseIf cmbType.ListIndex = 1 Then '查看视频
- wmp1.URL = strFile '设置播放文件
- wmp1.Controls.play '播放视频
- End If
- End Sub
- Private Sub Form_Load()
- On Error Resume Next
- wmp1.Left = pic1.Left '设置MediaPlayer控件坐标和尺寸
- wmp1.Top = pic1.Top
- wmp1.Width = pic1.Width
- wmp1.Height = pic1.Height
- wmp1.Visible = False
- pic1.Visible = True
- filShow.Path = App.Path & "TEMP" '设置文件列表框的路径
- filShow.Pattern = "*.BMP" '设置安始显示文件类型
- With cmbType
- .Clear '清空列表框
- .AddItem "图片" '添加项目
- .AddItem "视频"
- cmbType.ListIndex = 0 '选择列表框中的第1项
- End With
- RefreshList '刷新列表
- End Sub
- Private Sub RefreshList() '刷新图像列表
- filShow.Refresh '刷新列表
- If cmbType.ListIndex = 0 Then '显示图片
- cmdPlay.Enabled = True '允许循环图片按钮
- wmp1.Controls.stop '停止播放视频
- wmp1.Close '关闭视频
- wmp1.Visible = False '隐藏MediaPlayer控件
- pic1.Visible = True '显示图片控件
- pic1.Picture = Me.Picture '显示图片
- ElseIf cmbType.ListIndex = 1 Then '显示视频
- cmdPlay.Enabled = False '禁止循环图片按钮
- wmp1.Visible = True '显示MediaPlayer控件
- pic1.Visible = False '隐藏图片控件
- timer1.Enabled = False '禁止计时器
- End If
- If filShow.ListCount > 0 Then '有文件列表
- cmdDelete.Enabled = True '允行删除按钮
- cmdDeleteAll.Enabled = True '允许全部删除按钮
- Else
- cmdDelete.Enabled = False '禁止删除按钮
- cmdDeleteAll.Enabled = False '禁止全部删除按钮
- End If
- End Sub
- Private Sub timer1_Timer()
- If filShow.ListIndex < (filShow.ListCount - 1) Then '显示下一个图片
- filShow.ListIndex = filShow.ListIndex + 1
- Else
- timer1.Enabled = False '禁止时钟控件
- cmdPlay.Caption = "循环图片"
- End If
- End Sub