只需从 Windows 窗体控件集合中删除 Flash 控件。这是我实现它的方法(下面的代码经过测试并且可以完美运行):
public partial class Form1 : Form
{
private AxShockwaveFlashObjects.AxShockwaveFlash axFlash;
public Form1()
{
InitializeComponent();
axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();
axFlash.BeginInit();
axFlash.Location = new Point(50, 50);
axFlash.Name = "Load/unload test";
axFlash.TabIndex = 0;
axFlash.EndInit();
}
private void startButton_Click(object sender, EventArgs e)
{
axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();
axFlash.BeginInit();
axFlash.Location = new Point(50, 80);
axFlash.Name = "Test Movie";
axFlash.TabIndex = 0;
axFlash.Size = new Size(640, 480);
axFlash.EndInit();
this.Controls.Add(axFlash);
axFlash.LoadMovie(0, @"C:\Movies\MyMovie.swf");
}
private void unloadButton_Click(object sender, EventArgs e)
{
this.Controls.Remove(axFlash);
}
}