Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents StandardMenuCheckBox As System.Windows.Forms.CheckBox
    Friend WithEvents SoundsCheckBox As System.Windows.Forms.CheckBox
    Friend WithEvents PlaySWFFromFileButton As System.Windows.Forms.Button
    Friend WithEvents MoreAboutComponentButton As System.Windows.Forms.Button
    Friend WithEvents OrderButton As System.Windows.Forms.Button
    Friend WithEvents OpenSWFFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.StandardMenuCheckBox = New System.Windows.Forms.CheckBox
        Me.SoundsCheckBox = New System.Windows.Forms.CheckBox
        Me.PlaySWFFromFileButton = New System.Windows.Forms.Button
        Me.MoreAboutComponentButton = New System.Windows.Forms.Button
        Me.OrderButton = New System.Windows.Forms.Button
        Me.OpenSWFFileDialog = New System.Windows.Forms.OpenFileDialog
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.SuspendLayout()
        '
        'StandardMenuCheckBox
        '
        Me.StandardMenuCheckBox.Location = New System.Drawing.Point(8, 376)
        Me.StandardMenuCheckBox.Name = "StandardMenuCheckBox"
        Me.StandardMenuCheckBox.Size = New System.Drawing.Size(216, 24)
        Me.StandardMenuCheckBox.TabIndex = 1
        Me.StandardMenuCheckBox.Text = "Enable standard flash context menu"
        '
        'SoundsCheckBox
        '
        Me.SoundsCheckBox.Location = New System.Drawing.Point(232, 376)
        Me.SoundsCheckBox.Name = "SoundsCheckBox"
        Me.SoundsCheckBox.TabIndex = 2
        Me.SoundsCheckBox.Text = "Enable sounds"
        '
        'PlaySWFFromFileButton
        '
        Me.PlaySWFFromFileButton.Location = New System.Drawing.Point(8, 408)
        Me.PlaySWFFromFileButton.Name = "PlaySWFFromFileButton"
        Me.PlaySWFFromFileButton.Size = New System.Drawing.Size(128, 24)
        Me.PlaySWFFromFileButton.TabIndex = 3
        Me.PlaySWFFromFileButton.Text = "Play SWF from file..."
        '
        'MoreAboutComponentButton
        '
        Me.MoreAboutComponentButton.Location = New System.Drawing.Point(272, 408)
        Me.MoreAboutComponentButton.Name = "MoreAboutComponentButton"
        Me.MoreAboutComponentButton.Size = New System.Drawing.Size(176, 24)
        Me.MoreAboutComponentButton.TabIndex = 3
        Me.MoreAboutComponentButton.Text = "More about F-IN-BOX"
        '
        'OrderButton
        '
        Me.OrderButton.Location = New System.Drawing.Point(456, 408)
        Me.OrderButton.Name = "OrderButton"
        Me.OrderButton.Size = New System.Drawing.Size(168, 24)
        Me.OrderButton.TabIndex = 3
        Me.OrderButton.Text = "Buy license"
        '
        'OpenSWFFileDialog
        '
        Me.OpenSWFFileDialog.Filter = "Flash Movies (*.swf)|*.swf|All Files (*.*)|*.*"
        '
        'PictureBox1
        '
        Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(616, 360)
        Me.PictureBox1.TabIndex = 4
        Me.PictureBox1.TabStop = False
        Me.PictureBox1.Visible = False
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(632, 446)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.PlaySWFFromFileButton)
        Me.Controls.Add(Me.SoundsCheckBox)
        Me.Controls.Add(Me.StandardMenuCheckBox)
        Me.Controls.Add(Me.MoreAboutComponentButton)
        Me.Controls.Add(Me.OrderButton)
        Me.MaximizeBox = False
        Me.Name = "Form1"
        Me.Text = "Sample 3 - Standalone Flash Player (how to embed flash.ocx into an application)"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private f_in_box__control1 As f_in_box__lib.f_in_box__control

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        OpenSWFFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(Application.ExecutablePath())

        'Loads flash.ocx from resource
        Dim StreamWithFlashOCXCode As System.IO.Stream

        If IntPtr.Size = 8 Then
            ' 64 bit Windows
            ' Don't forget to add Flash64_14_0_0_176.ocx to the project
            StreamWithFlashOCXCode = Me.GetType().Assembly.GetManifestResourceStream("Sample03_StandalonePlayer.Flash64_14_0_0_176.ocx")
        Else
            ' 32 bit Windows
            StreamWithFlashOCXCode = Me.GetType().Assembly.GetManifestResourceStream("Sample03_StandalonePlayer.flash.ocx")
        End If

        If StreamWithFlashOCXCode Is Nothing Then
            MsgBox("Resource 'Flash.ocx' not found")
        End If

        Dim code As New f_in_box__lib.AxCode(StreamWithFlashOCXCode)

        f_in_box__control1 = New f_in_box__lib.f_in_box__control(code)

        f_in_box__control1.Location = PictureBox1.Location
        f_in_box__control1.Size = PictureBox1.Size

        'f_in_box__control1.Visible = True

        Controls.Add(f_in_box__control1)

        f_in_box__control1.PutMovieFromStream(Me.GetType().Assembly.GetManifestResourceStream("Sample03_StandalonePlayer.movie.swf"))
        f_in_box__control1.FlashMethod_Play()

        SoundsCheckBox.Checked = f_in_box__control1.AxCode.SoundEnabled
        StandardMenuCheckBox.Checked = f_in_box__control1.StandardMenu
    End Sub

    Private Sub PlaySWFFromFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlaySWFFromFileButton.Click
        If OpenSWFFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            f_in_box__control1.FlashProperty_Movie = OpenSWFFileDialog.FileName
        End If
    End Sub

    Private Sub StandardMenuCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StandardMenuCheckBox.CheckedChanged
        f_in_box__control1.StandardMenu = StandardMenuCheckBox.Checked
    End Sub

    Private Sub SoundsCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SoundsCheckBox.CheckedChanged
        f_in_box__control1.AxCode.SoundEnabled = SoundsCheckBox.Checked
    End Sub

    Private Sub MoreAboutComponentButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MoreAboutComponentButton.Click
        System.Diagnostics.Process.Start("http://www.f-in-box.com/dotnet/")
    End Sub

    Private Sub OrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrderButton.Click
        System.Diagnostics.Process.Start("http://www.f-in-box.com/dotnet/order.html")
    End Sub
End Class
