当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > flash内嵌于C#程序中的应用

ASP.NET
如何使用vb6.0来实现中文实名搜索
C#实现Window管道技术
记录下一些关于测试工具NUNIT的链接资料,有兴趣的朋友也可以跳过去看看
编写与.NET属性窗口交互的RAD组件(自序)
asp.net 关于form认证的一般设置:
编写与.NET属性窗口交互的RAD组件(一)
ActiveX控件的打包发布[无证书发布](一)
Visual SourceSafe 6.0 的问题思考
VB报表输出的问题,恳请不吝赐教
证书和签名--试用微软提供的证书测试工具系列
[dotNET]如何利用ConfigurationSettings.AppSettings.GetValues读取配置文件中多个...
使用C#编写DES加密程序的framework
令你的网页速度大大提高
怎样得到一个系统盘的全名,不是字符,是全名,如:本地磁盘(C:)?
r在richtextbox中插入动画/控件
Code: Writing Text to a File (Visual Basic)
算法讨论:哲学家就餐问题
我们所要关注的是什么?
firebird 连接嵌入式版本
从Csharp走到VB.Net(一):MyClass保留字

ASP.NET 中的 flash内嵌于C#程序中的应用


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 60 ::
收藏到网摘: n/a


flash player是以一个com+组件的形式插入到C#应用程序中的. 加入的方法和普通com+控件一样.这是我今年2月做的一个小试验。事实上我上半年做的项目一直跟这方面有关,所以对这方面还是有一些经验的。现在由于公司项目的启动,所以要对这个熟悉一下,然后整以成熟的方法,使它们之间的接口更有通用性。这方面有一个开源项目flashCsharp做得还不错。但他只是对文件控制不错,扩展性不是很强。这个小试验是一个媒体播放器,由flash来控制,先熟悉一下。  
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;namespace mediaplay{ /// /// Form1 的摘要说明。 /// public class Form1 : System.Windows.Forms.Form { private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1; private AxShockwaveFlashObjects.AxShockwaveFlash axShockwaveFlash1; /// /// 必需的设计器变量。 /// private System.ComponentModel.Container components = null; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // axShockwaveFlash1.Movie=Application.StartupPath+"\\videoControlButtons.swf"; axWindowsMediaPlayer1.URL=Application.StartupPath+"\\movie.avi"; } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer(); this.axShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash(); ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).BeginInit(); this.SuspendLayout(); // // axWindowsMediaPlayer1 // this.axWindowsMediaPlayer1.Anchor = System.Windows.Forms.AnchorStyles.Top; this.axWindowsMediaPlayer1.Enabled = true; this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(4, 1); this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1"; this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState"))); this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(312, 248); this.axWindowsMediaPlayer1.TabIndex = 0; this.axWindowsMediaPlayer1.Enter += new System.EventHandler(this.axWindowsMediaPlayer1_Enter); // // axShockwaveFlash1 // this.axShockwaveFlash1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.axShockwaveFlash1.Enabled = true; this.axShockwaveFlash1.Location = new System.Drawing.Point(9, 255); this.axShockwaveFlash1.Name = "axShockwaveFlash1"; this.axShockwaveFlash1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState"))); this.axShockwaveFlash1.Size = new System.Drawing.Size(300, 150); this.axShockwaveFlash1.TabIndex = 1; this.axShockwaveFlash1.FSCommand += new AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEventHandler(this.axShockwaveFlash1_FSCommand); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(320, 398); this.Controls.Add(this.axShockwaveFlash1); this.Controls.Add(this.axWindowsMediaPlayer1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).EndInit(); this.ResumeLayout(false); } #endregion /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.Run(new Form1()); } private void axShockwaveFlash1_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e) { switch(e.command) { case "pause": { axWindowsMediaPlayer1.Ctlcontrols.pause(); } break; case "play":axWindowsMediaPlayer1.Ctlc