gpt4 book ai didi

c# - 在 Windows 窗体中重新加载和刷新 Flash 文件

转载 作者:行者123 更新时间:2023-11-30 16:32:38 25 4
gpt4 key购买 nike

使用 DOTNET 3.5。我有一个应用程序,它使用此代码显示加载 Flash 电影的形式

axShockwaveFlash1 = 新的 AxShockwaveFlashObjects.AxShockwaveFlash() axShockwaveFlash1.LoadMovie(0, Form1.currentGame);

问题是,每当我对我们应用程序中托管的闪存进行更改并尝试刷新以查看更改时,新更改就会“困惑”。更具体地说,似乎以前的闪光灯的背景和一些控件仍然存在,“破坏”了加载的新闪光灯。为什么?

在加载第二个flash视频之前使用下面的方法没有区别

axShockwaveFlash1.Refresh(); axShockwaveFlash1.Stop();

最佳答案

我尝试了其他方法,但对我不起作用。这是我为实现预期结果所做的工作。

private void btnReload_Click(object sender, EventArgs e)
{
byte[] fileContent = File.ReadAllBytes(Application.StartupPath + @"\yourflashfile.swf");

if (fileContent != null && fileContent.Length > 0)
{
using (MemoryStream stm = new MemoryStream())
{
using (BinaryWriter writer = new BinaryWriter(stm))
{
/* Write length of stream for AxHost.State */
writer.Write(8 + fileContent.Length);
/* Write Flash magic 'fUfU' */
writer.Write(0x55665566);
/* Length of swf file */
writer.Write(fileContent.Length);
writer.Write(fileContent);
stm.Seek(0, SeekOrigin.Begin);
/* 1 == IPeristStreamInit */
//Same as LoadMovie()
this.axShockwaveFlash1.OcxState = new AxHost.State(stm, 1, false, null);
}
}

fileContent = null;
GC.Collect();
}
}

我在 SO 的某处复制了核心代码,但我不记得源代码了。

关于c# - 在 Windows 窗体中重新加载和刷新 Flash 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3899672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com