开发者

Play swf files in C#

I add 'ShockwaveFlashObject' in toolb开发者_如何学Pythonox and drag it on form and write below code but nothing happen why?

axShockwaveFlash1.Movie=Application.StartupPath+"\flash.swf";
        axShockwaveFlash1.Play();

and

axShockwaveFlash1.LoadMovie(0, Application.StartupPath + "\flash.swf");
        axShockwaveFlash1.Play();


because of escape character;

string path = Application.StartupPath+"\flash.swf";

path is actually equal to C:\Users\username\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debuglash.swf as you see ...\Debug + \f has converted to Debug

to avoid escaping characters use @

string path = Application.StartupPath+@"\flash.swf";

now path is equal to C:\Users\username\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\flash.swf

prolly that's what you want to get.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜