| 发表于:2007-03-16 20:00:362楼 得分:0 |
这是完整的代码: using system; using system.drawing; using system.collections; using system.componentmodel; using system.windows.forms; using system.data; namespace flashplayer { /// <summary> /// form1 的摘要说明。 /// </summary> public class form1 : system.windows.forms.form { private system.windows.forms.mainmenu mainmenu1; private system.windows.forms.menuitem menuitem1; private system.windows.forms.menuitem menuitem2; private axshockwaveflashobjects.axshockwaveflash axshockwaveflash1; private system.windows.forms.button btnplay; private system.windows.forms.button btnstop; private system.windows.forms.openfiledialog openflashdlg; private system.windows.forms.button btnpause; /// <summary> /// 必需的设计器变量。 /// </summary> private system.componentmodel.container components = null; public form1() { // // windows 窗体设计器支持所必需的 // initializecomponent(); // // todo: 在 initializecomponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void dispose( bool disposing ) { if( disposing ) { if (components != null) { components.dispose(); } } base.dispose( disposing ); } #region windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void initializecomponent() { system.resources.resourcemanager resources = new system.resources.resourcemanager(typeof(form1)); this.mainmenu1 = new system.windows.forms.mainmenu(); this.menuitem1 = new system.windows.forms.menuitem(); this.menuitem2 = new system.windows.forms.menuitem(); this.axshockwaveflash1 = new axshockwaveflashobjects.axshockwaveflash(); this.btnplay = new system.windows.forms.button(); this.btnstop = new system.windows.forms.button(); this.openflashdlg = new system.windows.forms.openfiledialog(); this.btnpause = new system.windows.forms.button(); ((system.componentmodel.isupportinitialize)(this.axshockwaveflash1)).begininit(); this.suspendlayout(); // // mainmenu1 // this.mainmenu1.menuitems.addrange(new system.windows.forms.menuitem[] { this.menuitem1}); // // menuitem1 // this.menuitem1.index = 0; this.menuitem1.menuitems.addrange(new system.windows.forms.menuitem[] { this.menuitem2}); this.menuitem1.text = "文件 "; // // menuitem2 // this.menuitem2.index = 0; this.menuitem2.text = "打开文件 "; this.menuitem2.click += new system.eventhandler(this.menuitem2_click); // // axshockwaveflash1 // this.axshockwaveflash1.dock = system.windows.forms.dockstyle.fill; this.axshockwaveflash1.enabled = true; this.axshockwaveflash1.location = new system.drawing.point(0, 0); this.axshockwaveflash1.name = "axshockwaveflash1 "; this.axshockwaveflash1.ocxstate = ((system.windows.forms.axhost.state)(resources.getobject( "axshockwaveflash1.ocxstate "))); this.axshockwaveflash1.size = new system.drawing.size(328, 266); this.axshockwaveflash1.tabindex = 4; // // btnplay // this.btnplay.backcolor = system.drawing.systemcolors.controltext; this.btnplay.forecolor = system.drawing.systemcolors.activecaption; this.btnplay.location = new system.drawing.point(24, 216); this.btnplay.name = "btnplay "; this.btnplay.size = new system.drawing.size(56, 24); this.btnplay.tabindex = 5; this.btnplay.text = "开始 "; this.btnplay.click += new system.eventhandler(this.btnplay_click); // // btnstop // this.btnstop.backcolor = system.drawing.systemcolors.controltext; this.btnstop.forecolor = system.drawing.systemcolors.activecaption; this.btnstop.location = new system.drawing.point(216, 216); this.btnstop.name = "btnstop "; this.btnstop.size = new system.drawing.size(56, 24); this.btnstop.tabindex = 9; this.btnstop.text = "停止 "; this.btnstop.click += new system.eventhandler(this.btnstop_click); // // btnpause // this.btnpause.backcolor = system.drawing.systemcolors.controltext; this.btnpause.forecolor = system.drawing.systemcolors.activecaption; this.btnpause.location = new system.drawing.point(112, 216); this.btnpause.name = "btnpause "; this.btnpause.size = new system.drawing.size(56, 24); this.btnpause.tabindex = 10; this.btnpause.text = "暂停 "; this.btnpause.click += new system.eventhandler(this.btnpause_click); // // form1 // this.autoscalebasesize = new system.drawing.size(6, 14); this.clientsize = new system.drawing.size(328, 266); this.controls.add(this.btnpause); this.controls.add(this.btnstop); this.controls.add(this.btnplay); this.controls.add(this.axshockwaveflash1); this.menu = this.mainmenu1; this.name = "form1 "; this.text = "form1 "; ((system.componentmodel.isupportinitialize)(this.axshockwaveflash1)).endinit(); this.resumelayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [stathread] static void main() { application.run(new form1()); } private void menuitem2_click(object sender, system.eventargs e) { openflashdlg.filter= "flash动画(*.swf) ¦*.swf ¦mp3文件(*.mp3) ¦*.mp3 "; if((openflashdlg.showdialog()==dialogresult.ok )&&(openflashdlg.filename!= " ")) { btnplay.enabled=true; axshockwaveflash1.movie =openflashdlg.filename; this.text= "flashplayer "+openflashdlg.filenames ; } } private void btnplay_click(object sender, system.eventargs e) { this.axshockwaveflash1.play(); this.btnplay .enabled =false; this.btnpause .enabled =true; this.btnstop .enabled =true; } private void btnstop_click(object sender, system.eventargs e) { this.axshockwaveflash1 .stop(); this.btnpause .enabled =false; this.btnplay .enabled =true; this.btnstop .enabled =false; } private void btnpause_click(object sender, system.eventargs e) { if(this.axshockwaveflash1 .playing) this.axshockwaveflash1.playing=false; this.btnpause.enabled =false; this.btnplay.enabled =true; this.btnstop.enabled =false; } } } | | |
|