로딩 할 때 WebBrowser에서 Flash (.swf) 파일을 재생해야하는 Windows 응용 프로그램을 만들어야합니다. 하지만 플래시 파일을 하드 디스크에서 WebBrowser 컨트롤로 직접 재생할 수 있습니다. 여기에서 .swf 파일을 Resources 폴더에서 재생하고 WebBrowser 컨트롤에로드해야합니다. 도와주세요.Resources 폴더에 SWF 파일을 재생하는 방법
미리 감사드립니다.
로딩 할 때 WebBrowser에서 Flash (.swf) 파일을 재생해야하는 Windows 응용 프로그램을 만들어야합니다. 하지만 플래시 파일을 하드 디스크에서 WebBrowser 컨트롤로 직접 재생할 수 있습니다. 여기에서 .swf 파일을 Resources 폴더에서 재생하고 WebBrowser 컨트롤에로드해야합니다. 도와주세요.Resources 폴더에 SWF 파일을 재생하는 방법
미리 감사드립니다.
System.Reflection.Assembly thisExe;
thisExe = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream file = thisExe.GetManifestResourceStream("Namespace.Filename");
byte[] data = Properties.Resources.Filename;
file.Read(data, 0, data.Length);
플래시 (.swf) 파일을 포함 된 리소스로 추가하십시오.
이 방법을 사용하면 예상대로 작동합니다.
private void Form1_Shown(object sender, EventArgs e)
{
Stream sr = Assembly.GetExecutingAssembly().GetManifestResourceStream("namespace.file.swf");
if (sr == null) return;
var reader = new BufferedStream(sr);
string tempfile = Path.GetTempFileName() + ".swf";
var data = new byte[reader.Length];
reader.Read(data, 0, (int)reader.Length);
File.WriteAllBytes(tempfile, data);
webBrowser1.Url = new Uri(tempfile);
}
희망이 있습니다.
어떻게 플래시를 하드 디스크에서 재생합니까? – abatishchev
은 웹 브라우저 컨트롤의 탐색 방법에서 경로를 지정했습니다. –
작동 여부는 확실하지만 리소스 스트림을 테스트 한 적이 있습니까? 이 시도. 그렇지 않다면 스트림을 임시 파일에 기록하는 것은 어떻습니까? –