VB.Net Tutorial/Windows/Flash Player — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:56, 26 мая 2010

Flash Player

Imports System.Windows.Forms
public class FlashPlayer
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class
Public Class Form1
    Inherits System.Windows.Forms.Form
    Public Sub New()
        MyBase.New()
        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.ruponentModel.IContainer
    Friend WithEvents AxShockwaveFlash1 As AxShockwaveFlashObjects.AxShockwaveFlash
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem9 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem10 As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.AxShockwaveFlash1 = New AxShockwaveFlashObjects.AxShockwaveFlash
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
        Me.MainMenu1 = New System.Windows.Forms.MainMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MenuItem2 = New System.Windows.Forms.MenuItem
        Me.MenuItem3 = New System.Windows.Forms.MenuItem
        Me.MenuItem4 = New System.Windows.Forms.MenuItem
        Me.MenuItem5 = New System.Windows.Forms.MenuItem
        Me.MenuItem6 = New System.Windows.Forms.MenuItem
        Me.MenuItem7 = New System.Windows.Forms.MenuItem
        Me.MenuItem8 = New System.Windows.Forms.MenuItem
        Me.MenuItem9 = New System.Windows.Forms.MenuItem
        Me.MenuItem10 = New System.Windows.Forms.MenuItem
        CType(Me.AxShockwaveFlash1, System.ruponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        "
        "AxShockwaveFlash1
        "
        Me.AxShockwaveFlash1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.AxShockwaveFlash1.Enabled = True
        Me.AxShockwaveFlash1.Location = New System.Drawing.Point(0, 0)
        Me.AxShockwaveFlash1.Name = "AxShockwaveFlash1"
        Me.AxShockwaveFlash1.OcxState = CType(resources.GetObject("AxShockwaveFlash1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.AxShockwaveFlash1.Size = New System.Drawing.Size(292, 266)
        Me.AxShockwaveFlash1.TabIndex = 0
        "
        "MainMenu1
        "
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem4})
        "
        "MenuItem1
        "
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2, Me.MenuItem3})
        Me.MenuItem1.Text = "File"
        "
        "MenuItem2
        "
        Me.MenuItem2.Index = 0
        Me.MenuItem2.Text = "Open"
        "
        "MenuItem3
        "
        Me.MenuItem3.Index = 1
        Me.MenuItem3.Text = "Exit"
        "
        "MenuItem4
        "
        Me.MenuItem4.Index = 1
        Me.MenuItem4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem5, Me.MenuItem6, Me.MenuItem10, Me.MenuItem7, Me.MenuItem8, Me.MenuItem9})
        Me.MenuItem4.Text = "Player"
        "
        "MenuItem5
        "
        Me.MenuItem5.Index = 0
        Me.MenuItem5.Text = "Start"
        "
        "MenuItem6
        "
        Me.MenuItem6.Index = 1
        Me.MenuItem6.Text = "Pause"
        "
        "MenuItem7
        "
        Me.MenuItem7.Index = 3
        Me.MenuItem7.Text = "Forward"
        "
        "MenuItem8
        "
        Me.MenuItem8.Index = 4
        Me.MenuItem8.Text = "Backward"
        "
        "MenuItem9
        "
        Me.MenuItem9.Index = 5
        Me.MenuItem9.Text = "Loop"
        "
        "MenuItem10
        "
        Me.MenuItem10.Index = 2
        Me.MenuItem10.Text = "Continue"
        "
        "Form1
        "
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.Add(Me.AxShockwaveFlash1)
        Me.Menu = Me.MainMenu1
        CType(Me.AxShockwaveFlash1, System.ruponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
    End Sub
    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        OpenFileDialog1.Filter = "Flash Files(*.swf)|*swf"
        OpenFileDialog1.ShowDialog()
        AxShockwaveFlash1.Movie = OpenFileDialog1.FileName
        AxShockwaveFlash1.GotoFrame(0)
        AxShockwaveFlash1.Play()
    End Sub
    Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
        End
    End Sub
    Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
        AxShockwaveFlash1.GotoFrame(0)
        AxShockwaveFlash1.Play()
    End Sub
    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
        AxShockwaveFlash1.Stop()
        MenuItem8.Enabled = False
        MenuItem7.Enabled = False
    End Sub
    Private Sub MenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem10.Click
        AxShockwaveFlash1.Play()
        MenuItem8.Enabled = True
        MenuItem7.Enabled = True
    End Sub
    Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
        AxShockwaveFlash1.Forward()
    End Sub
    Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem8.Click
        AxShockwaveFlash1.Back()
    End Sub
    Private Sub MenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem9.Click
        If (MenuItem9.Checked = False) Then
            MenuItem9.Checked = True
            AxShockwaveFlash1.Loop = True
        ElseIf (MenuItem9.Checked = True) Then
            MenuItem9.Checked = False
            AxShockwaveFlash1.Loop = False
        End If
    End Sub
End Class