📄 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
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents AniGIF1 As AxAniGIFCtrl.AxAniGIF
Public WithEvents Load_Renamed As System.Windows.Forms.Button
Public WithEvents Stop_Renamed As System.Windows.Forms.Button
Public WithEvents play As System.Windows.Forms.Button
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
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器来修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
Me.ToolTip1.Active = True
Me.AniGIF1 = New AxAniGIFCtrl.AxAniGIF
Me.Load_Renamed = New System.Windows.Forms.Button
Me.Stop_Renamed = New System.Windows.Forms.Button
Me.play = New System.Windows.Forms.Button
Me.File1 = New Microsoft.VisualBasic.Compatibility.VB6.FileListBox
Me.Dir1 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Me.Drive1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
CType(Me.AniGIF1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Text = "GIF图像显示"
Me.ClientSize = New System.Drawing.Size(401, 236)
Me.Location = New System.Drawing.Point(69, 97)
Me.MaximizeBox = False
Me.BackgroundImage = CType(resources.GetObject("Form1.BackgroundImage"), System.Drawing.Image)
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.SystemColors.Control
Me.ControlBox = True
Me.Enabled = True
Me.KeyPreview = False
Me.MinimizeBox = True
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.ShowInTaskbar = True
Me.HelpButton = False
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
Me.Name = "Form1"
AniGIF1.OcxState = CType(resources.GetObject("AniGIF1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AniGIF1.Size = New System.Drawing.Size(289, 97)
Me.AniGIF1.Location = New System.Drawing.Point(8, 8)
Me.AniGIF1.TabIndex = 6
Me.AniGIF1.Name = "AniGIF1"
Me.Load_Renamed.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.Load_Renamed.Text = "载入图像"
Me.Load_Renamed.Size = New System.Drawing.Size(81, 25)
Me.Load_Renamed.Location = New System.Drawing.Point(312, 8)
Me.Load_Renamed.TabIndex = 5
Me.Load_Renamed.BackColor = System.Drawing.SystemColors.Control
Me.Load_Renamed.CausesValidation = True
Me.Load_Renamed.Enabled = True
Me.Load_Renamed.ForeColor = System.Drawing.SystemColors.ControlText
Me.Load_Renamed.Cursor = System.Windows.Forms.Cursors.Default
Me.Load_Renamed.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Load_Renamed.TabStop = True
Me.Load_Renamed.Name = "Load_Renamed"
Me.Stop_Renamed.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.Stop_Renamed.Text = "停止播放"
Me.Stop_Renamed.Size = New System.Drawing.Size(81, 25)
Me.Stop_Renamed.Location = New System.Drawing.Point(312, 80)
Me.Stop_Renamed.TabIndex = 4
Me.Stop_Renamed.BackColor = System.Drawing.SystemColors.Control
Me.Stop_Renamed.CausesValidation = True
Me.Stop_Renamed.Enabled = True
Me.Stop_Renamed.ForeColor = System.Drawing.SystemColors.ControlText
Me.Stop_Renamed.Cursor = System.Windows.Forms.Cursors.Default
Me.Stop_Renamed.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Stop_Renamed.TabStop = True
Me.Stop_Renamed.Name = "Stop_Renamed"
Me.play.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.play.Text = "开始播放"
Me.play.Size = New System.Drawing.Size(81, 25)
Me.play.Location = New System.Drawing.Point(312, 40)
Me.play.TabIndex = 3
Me.play.BackColor = System.Drawing.SystemColors.Control
Me.play.CausesValidation = True
Me.play.Enabled = True
Me.play.ForeColor = System.Drawing.SystemColors.ControlText
Me.play.Cursor = System.Windows.Forms.Cursors.Default
Me.play.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.play.TabStop = True
Me.play.Name = "play"
Me.File1.Size = New System.Drawing.Size(201, 102)
Me.File1.Location = New System.Drawing.Point(192, 120)
Me.File1.Pattern = "*.gif"
Me.File1.TabIndex = 1
Me.File1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.File1.Archive = True
Me.File1.BackColor = System.Drawing.SystemColors.Window
Me.File1.CausesValidation = True
Me.File1.Enabled = True
Me.File1.ForeColor = System.Drawing.SystemColors.WindowText
Me.File1.Hidden = False
Me.File1.Cursor = System.Windows.Forms.Cursors.Default
Me.File1.SelectionMode = System.Windows.Forms.SelectionMode.One
Me.File1.Normal = True
Me.File1.ReadOnly = True
Me.File1.System = False
Me.File1.TabStop = True
Me.File1.TopIndex = 0
Me.File1.Visible = True
Me.File1.Name = "File1"
Me.Dir1.Size = New System.Drawing.Size(177, 87)
Me.Dir1.Location = New System.Drawing.Point(8, 144)
Me.Dir1.TabIndex = 0
Me.Dir1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Dir1.BackColor = System.Drawing.SystemColors.Window
Me.Dir1.CausesValidation = True
Me.Dir1.Enabled = True
Me.Dir1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Dir1.Cursor = System.Windows.Forms.Cursors.Default
Me.Dir1.TabStop = True
Me.Dir1.Visible = True
Me.Dir1.Name = "Dir1"
Me.Drive1.Size = New System.Drawing.Size(177, 19)
Me.Drive1.Location = New System.Drawing.Point(8, 120)
Me.Drive1.TabIndex = 2
Me.Drive1.BackColor = System.Drawing.SystemColors.Window
Me.Drive1.CausesValidation = True
Me.Drive1.Enabled = True
Me.Drive1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Drive1.Cursor = System.Windows.Forms.Cursors.Default
Me.Drive1.TabStop = True
Me.Drive1.Visible = True
Me.Drive1.Name = "Drive1"
Me.Controls.Add(AniGIF1)
Me.Controls.Add(Load_Renamed)
Me.Controls.Add(Stop_Renamed)
Me.Controls.Add(play)
Me.Controls.Add(File1)
Me.Controls.Add(Dir1)
Me.Controls.Add(Drive1)
CType(Me.AniGIF1, System.ComponentModel.ISupportInitialize).EndInit()
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
End Sub
Private Sub Drive1_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Drive1.SelectedIndexChanged
Dir1.Path = Drive1.Drive
End Sub
Private Sub Load_Renamed_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Load_Renamed.Click
Dim txtFrames As Object
If Not AniGIF1.ReadGIF(File1.Path & "\" & File1.FileName) Then
MsgBox("Read Wrong", 16)
End If
'If Not AniGIF1.ReadGIF("c:\activeX.gif") Then
'MsgBox("Read Wrong", 16)
'End If
txtFrames = AniGIF1.Frames
End Sub
Private Sub play_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles play.Click
AniGIF1.play()
End Sub
Private Sub Stop_Renamed_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Stop_Renamed.Click
AniGIF1.Stop()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -