📄 form1.vb
字号:
Option Strict Off
Option Explicit On
Friend Class Form1
Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'对于启动窗体,所创建的第一个实例为默认实例。
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'此调用是 Windows 窗体设计器所必需的。
InitializeComponent()
End Sub
'窗体重写处置,以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
Private components As System.ComponentModel.IContainer
'Windows 窗体设计器所必需的
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Text1 As System.Windows.Forms.TextBox
Public WithEvents File1 As Microsoft.VisualBasic.Compatibility.VB6.FileListBox
Public WithEvents Dir1 As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Public WithEvents Drive1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
Public WithEvents MMControl1 As AxMCI.AxMMControl
Public WithEvents Label1 As System.Windows.Forms.Label
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器来修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.Label1 = New System.Windows.Forms.Label()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.Drive1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox()
Me.Dir1 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox()
Me.MMControl1 = New AxMCI.AxMMControl()
Me.File1 = New Microsoft.VisualBasic.Compatibility.VB6.FileListBox()
Me.Text1 = New System.Windows.Forms.TextBox()
CType(Me.MMControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(317, 37)
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.Size = New System.Drawing.Size(114, 38)
Me.Label1.TabIndex = 5
Me.Label1.Text = "文件类型"
'
'Drive1
'
Me.Drive1.BackColor = System.Drawing.SystemColors.Window
Me.Drive1.Cursor = System.Windows.Forms.Cursors.Default
Me.Drive1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.Drive1.DropDownWidth = 278
Me.Drive1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Drive1.Location = New System.Drawing.Point(20, 37)
Me.Drive1.Name = "Drive1"
Me.Drive1.Size = New System.Drawing.Size(278, 22)
Me.Drive1.TabIndex = 1
'
'Dir1
'
Me.Dir1.BackColor = System.Drawing.SystemColors.Window
Me.Dir1.Cursor = System.Windows.Forms.Cursors.Default
Me.Dir1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Dir1.IntegralHeight = False
Me.Dir1.Location = New System.Drawing.Point(20, 93)
Me.Dir1.Name = "Dir1"
Me.Dir1.Size = New System.Drawing.Size(278, 145)
Me.Dir1.TabIndex = 2
'
'MMControl1
'
Me.MMControl1.Enabled = True
Me.MMControl1.Location = New System.Drawing.Point(20, 250)
Me.MMControl1.Name = "MMControl1"
Me.MMControl1.OcxState = CType(resources.GetObject("MMControl1.OcxState"), System.Windows.Forms.AxHost.State)
Me.MMControl1.Size = New System.Drawing.Size(555, 57)
Me.MMControl1.TabIndex = 0
'
'File1
'
Me.File1.BackColor = System.Drawing.SystemColors.Window
Me.File1.Cursor = System.Windows.Forms.Cursors.Default
Me.File1.ForeColor = System.Drawing.SystemColors.WindowText
Me.File1.ItemHeight = 12
Me.File1.Location = New System.Drawing.Point(307, 93)
Me.File1.Name = "File1"
Me.File1.Pattern = "*.*"
Me.File1.Size = New System.Drawing.Size(268, 124)
Me.File1.TabIndex = 3
'
'Text1
'
Me.Text1.AcceptsReturn = True
Me.Text1.AutoSize = False
Me.Text1.BackColor = System.Drawing.SystemColors.Window
Me.Text1.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text1.Location = New System.Drawing.Point(440, 28)
Me.Text1.MaxLength = 0
Me.Text1.Name = "Text1"
Me.Text1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text1.Size = New System.Drawing.Size(135, 38)
Me.Text1.TabIndex = 4
Me.Text1.Text = "File(*.avi)"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(761, 519)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Text1, Me.File1, Me.Dir1, Me.Drive1, Me.MMControl1, Me.Label1})
Me.Location = New System.Drawing.Point(4, 29)
Me.Name = "Form1"
Me.Text = "播放AVI文件"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
CType(Me.MMControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
#Region "升级支持"
Private Shared m_vb6FormDefInstance As Form1
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As Form1
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New Form1()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Private Sub Dir1_Change(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Dir1.Change
File1.Path = Dir1.Path
File1.FileName = "*.avi"
End Sub
Private Sub Drive1_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Drive1.SelectedIndexChanged
On Error GoTo Lable1
Dir1.Path = Drive1.Drive
Exit Sub
Lable1:
MsgBox("设备没有准备好!", MsgBoxStyle.OKOnly, "演示程序")
End Sub
Private Sub File1_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles File1.SelectedIndexChanged
MMControl1.FileName = Dir1.Path & "\" & File1.FileName
MMControl1.Command = "open"
End Sub
Private Sub File1_DoubleClick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles File1.DoubleClick
MMControl1.FileName = Dir1.Path & "\" & File1.FileName
MMControl1.Command = "open"
End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "AVIVideo"
Dir1.Path = VB6.GetPath
File1.Path = Dir1.Path
File1.FileName = "*.avi"
MMControl1.Command = "Close"
End Sub
'UPGRADE_WARNING: Form 事件 Form1.Unload 具有新的行为。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup2065.htm
Private Sub Form1_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
'MMControl1.Command = "stop"
' MMControl1.Command = "close"
'Me.Close()
End Sub
Private Sub MMControl1_Done(ByVal eventSender As System.Object, ByVal eventArgs As AxMCI.DmciEvents_DoneEvent) Handles MMControl1.Done
Select Case eventArgs.notifyCode
Case 0
MMControl1.Command = "close"
Case 3
MMControl1.Command = "play"
Case Else
End Select
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -