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

📄 form1.vb

📁 这是一本用Visual Studio.NET进行多媒体编程的读物
💻 VB
字号:
Option Strict Off
Option Explicit On
Friend Class frmMain
	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 cmdStop As System.Windows.Forms.Button
	Public WithEvents cmdPlay As System.Windows.Forms.Button
	Public WithEvents MediaPlayer1 As AxMediaPlayer.AxMediaPlayer
	'注意:以下过程是 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(frmMain))
        Me.cmdStop = New System.Windows.Forms.Button()
        Me.MediaPlayer1 = New AxMediaPlayer.AxMediaPlayer()
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.cmdPlay = New System.Windows.Forms.Button()
        CType(Me.MediaPlayer1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'cmdStop
        '
        Me.cmdStop.BackColor = System.Drawing.SystemColors.Control
        Me.cmdStop.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdStop.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.cmdStop.Location = New System.Drawing.Point(432, 128)
        Me.cmdStop.Name = "cmdStop"
        Me.cmdStop.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdStop.Size = New System.Drawing.Size(90, 50)
        Me.cmdStop.TabIndex = 2
        Me.cmdStop.Text = "停止"
        '
        'MediaPlayer1
        '
        Me.MediaPlayer1.Location = New System.Drawing.Point(8, 8)
        Me.MediaPlayer1.Name = "MediaPlayer1"
        Me.MediaPlayer1.OcxState = CType(resources.GetObject("MediaPlayer1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.MediaPlayer1.Size = New System.Drawing.Size(408, 320)
        Me.MediaPlayer1.TabIndex = 0
        '
        'cmdPlay
        '
        Me.cmdPlay.BackColor = System.Drawing.SystemColors.Control
        Me.cmdPlay.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdPlay.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.cmdPlay.Location = New System.Drawing.Point(432, 40)
        Me.cmdPlay.Name = "cmdPlay"
        Me.cmdPlay.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdPlay.Size = New System.Drawing.Size(90, 50)
        Me.cmdPlay.TabIndex = 1
        Me.cmdPlay.Text = "播放"
        '
        'frmMain
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(544, 335)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdStop, Me.cmdPlay, Me.MediaPlayer1})
        Me.Location = New System.Drawing.Point(4, 29)
        Me.Name = "frmMain"
        Me.Text = "CCRP Animation Control Demo"
        CType(Me.MediaPlayer1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As frmMain
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmMain
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmMain()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	
	
	Private Sub cmdPlay_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPlay.Click
		'UPGRADE_WARNING: 未能解析对象 MediaPlayer1.Play 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm

        MediaPlayer1.Play()

	End Sub
	
	Private Sub cmdStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdStop.Click
		'UPGRADE_WARNING: 未能解析对象 MediaPlayer1.Stop 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
		MediaPlayer1.Stop()
	End Sub
End Class

⌨️ 快捷键说明

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