如何播放Flash文件
首先我们从工具栏中添加一个COM控件
Shockwave Flash Object
把界面弄下
拽一个Shockwave Flash Object 控件
再看下代码
private void button1_Click(object sender, System.EventArgs e)
{//浏览FLASH文件
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
this.axShockwaveFlash1.Movie=this.openFileDialog1.FileName;
this.Text="演示播放FLASH文件-"+this.openFileDialog1.FileName;
}
}
private void button2_Click(object sender, System.EventArgs e)
{//播放FLASH文件
if(this.openFileDialog1.FileName.Length>0)
{
this.axShockwaveFlash1.Play();
}
else
{
MessageBox.Show("请选择FLASH文件!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button4_Click(object sender, System.EventArgs e)
{//第一帧
if(this.openFileDialog1.FileName.Length>0)
{
this.axShockwaveFlash1.Rewind();
}
else
{
MessageBox.Show("请选择FLASH文件!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button5_Click(object sender, System.EventArgs e)
{//停止播放
if(this.openFileDialog1.FileName.Length>0)
{
this.axShockwaveFlash1.Stop();
}
else
{
MessageBox.Show("请选择FLASH文件!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button3_Click(object sender, System.EventArgs e)
{//上一帧
if(this.openFileDialog1.FileName.Length>0)
{
this.axShockwaveFlash1.Back();
}
else
{
MessageBox.Show("请选择FLASH文件!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button6_Click(object sender, System.EventArgs e)
{//下一帧
if(this.openFileDialog1.FileName.Length>0)
{
this.axShockwaveFlash1.Forward();
}
else
{
MessageBox.Show("请选择FLASH文件!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}