Displaying Flash content in a C# WinForms applicat

2019-01-17 00:12发布

问题:

What is the best way to display Flash content in a C# WinForms application? I would like to create a user control (similar to the current PictureBox) that will be able to display images and flash content.

It would be great to be able to load the flash content from a stream of sorts rather than a file on disk.

回答1:

While I haven't used a flash object inside a windows form application myself, I do know that it's possible. In Visual studio on your toolbox, choose to add a new component. Then in the new window that appears choose the "COM Components" tab to get a list in which you can find the "Shockwave Flash Object"

Once added to the toolbox, simply use the control as you would use any other "standard" control from visual studio.

three simple commands are available to interact with the control:

  • AxShockwaveFlash1.Stop()
  • AxShockwaveFlash1.Movie = FilePath & "\FileName.swf"
  • AxShockwaveFlash1.Play()

which, I think, are all self explanatory.

It would be great to be able to load the flash content from a stream of sorts rather than a file on disk.

I just saw you are also looking for a means to load the content from a stream, and because I'm not really sure that is possible with the shockwave flash object I will give you another option (two actually).

the first is the one I would advise you to use only when necessary, as it uses the full blown "webbrowser component" (also available as an extra toolbox item), which is like trying to shoot a fly with a bazooka. of course it will work, as the control will act as a real browser window (actually the internet explorer browser), but its not really meant to be used in the way you need it.

the second option is to use something I just discovered while looking for more information about playing flash content inside a windows form. F-IN-BOX is a commercial solution that will also play content from a given website URL. (The link provided will direct you to the .NET code you have to use).



回答2:

Sven, you reached the same conclusion as I did: I found the Shockwave Flash Object, all be it from a slightly different route, but was stumped on how to load the files from somewhere other than file on disk/URL. The F-IN-BOX, although just a wrapper of the Shockwave Flash Object seems to provide much more functionality, which may just help me!

Shooting flys with bazookas may be fun, but an embeded web brower is not the path that I am looking for. :)

There was a link on Adobe's site that talked about "Embedding and Communicating with the Macromedia Flash Player in C# Windows Applications" but they seem to have removed it :(