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

📄 form1.vb

📁 这是一本用Visual Studio.NET进行多媒体编程的读物
💻 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 Command2 As System.Windows.Forms.Button
	Public WithEvents Command1 As System.Windows.Forms.Button
	Public WithEvents Timer1 As System.Windows.Forms.Timer
	Public WithEvents endStop As System.Windows.Forms.Button
	Public WithEvents imgPlay As System.Windows.Forms.Button
	Public WithEvents imgShow6 As System.Windows.Forms.PictureBox
	Public WithEvents imgShow5 As System.Windows.Forms.PictureBox
	Public WithEvents imgShow4 As System.Windows.Forms.PictureBox
	Public WithEvents imgShow3 As System.Windows.Forms.PictureBox
	Public WithEvents imgShow2 As System.Windows.Forms.PictureBox
	Public WithEvents imgShow1 As System.Windows.Forms.PictureBox
	Public WithEvents imgShow0 As System.Windows.Forms.PictureBox
	'注意:以下过程是 Windows 窗体设计器所必需的
	'可以使用 Windows 窗体设计器来修改它。
	'不要使用代码编辑器来修改它。
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.imgPlay = New System.Windows.Forms.Button()
        Me.imgShow1 = New System.Windows.Forms.PictureBox()
        Me.Command1 = New System.Windows.Forms.Button()
        Me.Command2 = New System.Windows.Forms.Button()
        Me.imgShow2 = New System.Windows.Forms.PictureBox()
        Me.imgShow3 = New System.Windows.Forms.PictureBox()
        Me.imgShow0 = New System.Windows.Forms.PictureBox()
        Me.imgShow6 = New System.Windows.Forms.PictureBox()
        Me.imgShow4 = New System.Windows.Forms.PictureBox()
        Me.imgShow5 = New System.Windows.Forms.PictureBox()
        Me.endStop = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Timer1
        '
        Me.Timer1.Interval = 1000
        '
        'imgPlay
        '
        Me.imgPlay.BackColor = System.Drawing.SystemColors.Control
        Me.imgPlay.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgPlay.Location = New System.Drawing.Point(664, 72)
        Me.imgPlay.Name = "imgPlay"
        Me.imgPlay.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.imgPlay.Size = New System.Drawing.Size(100, 50)
        Me.imgPlay.TabIndex = 0
        Me.imgPlay.Text = "播放"
        '
        'imgShow1
        '
        Me.imgShow1.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow1.Location = New System.Drawing.Point(61, 620)
        Me.imgShow1.Name = "imgShow1"
        Me.imgShow1.Size = New System.Drawing.Size(145, 112)
        Me.imgShow1.TabIndex = 9
        Me.imgShow1.TabStop = False
        '
        'Command1
        '
        Me.Command1.BackColor = System.Drawing.SystemColors.Control
        Me.Command1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command1.Location = New System.Drawing.Point(664, 192)
        Me.Command1.Name = "Command1"
        Me.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command1.Size = New System.Drawing.Size(100, 50)
        Me.Command1.TabIndex = 2
        Me.Command1.Text = "停止"
        '
        'Command2
        '
        Me.Command2.BackColor = System.Drawing.SystemColors.Control
        Me.Command2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command2.Location = New System.Drawing.Point(664, 128)
        Me.Command2.Name = "Command2"
        Me.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command2.Size = New System.Drawing.Size(100, 50)
        Me.Command2.TabIndex = 3
        Me.Command2.Text = "快看"
        '
        'imgShow2
        '
        Me.imgShow2.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow2.Location = New System.Drawing.Point(82, 639)
        Me.imgShow2.Name = "imgShow2"
        Me.imgShow2.Size = New System.Drawing.Size(145, 84)
        Me.imgShow2.TabIndex = 8
        Me.imgShow2.TabStop = False
        '
        'imgShow3
        '
        Me.imgShow3.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow3.Location = New System.Drawing.Point(61, 648)
        Me.imgShow3.Name = "imgShow3"
        Me.imgShow3.Size = New System.Drawing.Size(155, 94)
        Me.imgShow3.TabIndex = 7
        Me.imgShow3.TabStop = False
        '
        'imgShow0
        '
        Me.imgShow0.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow0.Location = New System.Drawing.Point(0, 64)
        Me.imgShow0.Name = "imgShow0"
        Me.imgShow0.Size = New System.Drawing.Size(568, 648)
        Me.imgShow0.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.imgShow0.TabIndex = 10
        Me.imgShow0.TabStop = False
        '
        'imgShow6
        '
        Me.imgShow6.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow6.Location = New System.Drawing.Point(225, 639)
        Me.imgShow6.Name = "imgShow6"
        Me.imgShow6.Size = New System.Drawing.Size(114, 103)
        Me.imgShow6.TabIndex = 4
        Me.imgShow6.TabStop = False
        '
        'imgShow4
        '
        Me.imgShow4.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow4.Location = New System.Drawing.Point(102, 629)
        Me.imgShow4.Name = "imgShow4"
        Me.imgShow4.Size = New System.Drawing.Size(166, 113)
        Me.imgShow4.TabIndex = 6
        Me.imgShow4.TabStop = False
        '
        'imgShow5
        '
        Me.imgShow5.Cursor = System.Windows.Forms.Cursors.Default
        Me.imgShow5.Location = New System.Drawing.Point(236, 657)
        Me.imgShow5.Name = "imgShow5"
        Me.imgShow5.Size = New System.Drawing.Size(103, 75)
        Me.imgShow5.TabIndex = 5
        Me.imgShow5.TabStop = False
        '
        'endStop
        '
        Me.endStop.BackColor = System.Drawing.SystemColors.Control
        Me.endStop.Cursor = System.Windows.Forms.Cursors.Default
        Me.endStop.Location = New System.Drawing.Point(664, 256)
        Me.endStop.Name = "endStop"
        Me.endStop.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.endStop.Size = New System.Drawing.Size(100, 50)
        Me.endStop.TabIndex = 1
        Me.endStop.Text = "退出"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(968, 747)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Command2, Me.Command1, Me.endStop, Me.imgPlay, Me.imgShow6, Me.imgShow5, Me.imgShow4, Me.imgShow3, Me.imgShow2, Me.imgShow1, Me.imgShow0})
        Me.Location = New System.Drawing.Point(4, 29)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
        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 
	Dim a As Short
	
	Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
		Timer1.Enabled = False
	End Sub
	
	Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
		Timer1_Tick(Timer1, New System.EventArgs())
	End Sub
	
	Private Sub endStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles endStop.Click
		End
		imgShow0.Image = Nothing
	End Sub
	
	Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		imgShow0.Image = Nothing
		'假没图片文件在"d:\picture"子目录下为1.bmp-6.bmp
		imgShow1.Image = System.Drawing.Image.FromFile("f:\sunmengning\libo1.bmp")
		imgShow2.Image = System.Drawing.Image.FromFile("f:\sunmengning\libo2.bmp")
		imgShow3.Image = System.Drawing.Image.FromFile("f:\sunmengning\libo3.bmp")
		imgShow4.Image = System.Drawing.Image.FromFile("f:\sunmengning\libo4.bmp")
		imgShow5.Image = System.Drawing.Image.FromFile("f:\sunmengning\libo5.bmp")
		imgShow6.Image = System.Drawing.Image.FromFile("f:\sunmengning\libo6.bmp")
		
		imgShow0.Visible = True
		imgShow1.Visible = False
		imgShow2.Visible = False
		imgShow3.Visible = False
		imgShow4.Visible = False
		imgShow5.Visible = False
		imgShow6.Visible = False
	End Sub
	
	Private Sub imgPlay_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles imgPlay.Click
		'Timer1_Timer
		
		Timer1.Enabled = True
		
	End Sub
	
	Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick
		
		
		a = a + 1
		Select Case a Mod 7
			Case 1
				imgShow0.Image = imgShow1.Image
			Case 2
				imgShow0.Image = imgShow2.Image
			Case 3
				imgShow0.Image = imgShow3.Image
			Case 4
				imgShow0.Image = imgShow4.Image
			Case 5
				imgShow0.Image = imgShow5.Image
			Case 6
				imgShow0.Image = imgShow6.Image
				a = a + 1
		End Select
		
	End Sub
	
	Private Sub Timer2_Timer()
		End
	End Sub
End Class

⌨️ 快捷键说明

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