المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : i have problem axShockwaveFlash1_OnProgress



C# Programming
11-25-2009, 04:11 AM
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace FlashTest
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private AxShockwaveFlashObjects.AxShockwaveFlash axShockwaveFlash1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.Label label1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.axShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.trackBar1 = new System.Windows.Forms.TrackBar();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
this.SuspendLayout();
//
// axShockwaveFlash1
//
this.axShockwaveFlash1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.axShockwaveFlash1.Enabled = true;
this.axShockwaveFlash1.******** = new System.Drawing.Point(32, 24);
this.axShockwaveFlash1.Name = "axShockwaveFlash1";
this.axShockwaveFlash1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState")));
this.axShockwaveFlash1.Size = new System.Drawing.Size(728, 504);
this.axShockwaveFlash1.TabIndex = 0;
this.axShockwaveFlash1.OnProgress += new AxShockwaveFlashObjects._IShockwaveFlashEvents_OnProgressEventHandler(this.axShockwaveFlash1_OnProgr ess);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.******** = new System.Drawing.Point(32, 592);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Load";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button2.******** = new System.Drawing.Point(128, 592);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Play";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button3.******** = new System.Drawing.Point(224, 592);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 23);
this.button3.TabIndex = 3;
this.button3.Text = "Pause";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button4.******** = new System.Drawing.Point(320, 592);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(80, 23);
this.button4.TabIndex = 4;
this.button4.Text = "Stop";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// trackBar1
//
this.trackBar1.******** = new System.Drawing.Point(24, 536);
this.trackBar1.Maximum = 1;
this.trackBar1.Minimum = -1;
this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(744, 45);
this.trackBar1.TabIndex = 5;
this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar1.Value = -1;
this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
//
// label1
//
this.label1.******** = new System.Drawing.Point(680, 600);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 16);
this.label1.TabIndex = 6;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(792, 630);
this.Controls.Add(this.label1);
this.Controls.Add(this.trackBar1);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.axShockwaveFlash1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
axShockwaveFlash1.Movie = Directory.GetCurrentDirectory() + "\\A02_09.swf";
axShockwaveFlash1.StopPlay();
trackBar1.Maximum = axShockwaveFlash1.TotalFrames;
label1.Text = axShockwaveFlash1.TotalFrames.ToString();
}

private void button2_Click(object sender, System.EventArgs e)
{
axShockwaveFlash1.Play();
}

private void button3_Click(object sender, System.EventArgs e)
{
axShockwaveFlash1.StopPlay();
}

private void button4_Click(object sender, System.EventArgs e)
{
axShockwaveFlash1.StopPlay();
axShockwaveFlash1.FrameNum = -1;
}

// why this is not working... ?
private void axShockwaveFlash1_OnProgress(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnProgressEvent e)
{
this.trackBar1.Value = axShockwaveFlash1.FrameNum;
}

private void trackBar1_ValueChanged(object sender, System.EventArgs e)
{
axShockwaveFlash1.FrameNum = trackBar1.Value;
}
}
}


Thanks All..