首页 新闻 会员 周边 捐助

C# 确保文件时有效的.netframe程序集

-2
悬赏园豆:10 [已关闭问题] 关闭于 2012-09-03 23:38

以上我按照一本教程学习C#实例,组建自己播放器出的问题

代码:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.AudioVideoPlayback;

namespace player {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }

        private void Form1_Load(object sender, EventArgs e)         {             if (MyVideo == null)             {                 button2.Enabled = false;                 button3.Enabled = false;                 button4.Enabled = false;             }             else             {                 button2.Enabled=true;                 button3.Enabled=true;                 button4.Enabled=true;             }         }         private Video MyVideo = null;         private void button1_Click(object sender, EventArgs e)         {             openFileDialog1.InitialDirectory = Application.StartupPath;             if (openFileDialog1.ShowDialog() == DialogResult.OK)             {                 int height = p1.Height;                 int width = p1.Width;                 if (MyVideo != null)                 {                     MyVideo.Dispose();                 }                 MyVideo = new Video(openFileDialog1.FileName);                 MyVideo.Owner=p1;                 p1.Height=height;                 p1.Width=width;                 MyVideo.Play();                 MyVideo.Pause();             }             if(MyVideo==null)             {                 button2.Enabled = false;                 button3.Enabled = false;                 button4.Enabled = false;             }             else             {                 button2.Enabled=true;                 button3.Enabled=true;                 button4.Enabled=true;             }         }

        private void button2_Click(object sender, EventArgs e)         {             if (MyVideo != null)             {                 MyVideo.Play();             }         }

        private void button3_Click(object sender, EventArgs e)         {             if (MyVideo != null)             {                 MyVideo.Stop();             }         }

        private void button4_Click(object sender, EventArgs e)         {             if (MyVideo != null)             {                 MyVideo.Play();             }         }     } }

疯子!的主页 疯子! | 初学一级 | 园豆:192
提问于:2012-04-25 18:45
< >
分享
所有回答(1)
0

代码太凌乱了,能否整理下?

artwl | 园豆:16736 (专家六级) | 2012-04-25 22:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册