当前位置:编程学习 > C#/ASP.NET >>

大哥,为什么我编的C#程序播放不了视频?

刚接触C#,想编出一个能播放视频的程序,但结果只能播放音频。windows media player COM组建添加进去不能实现播放视频,用Microsoft.DirectX.AudioVideoPlayback类也不行。哪位高人指条明路,我的代码如下。

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 WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        private Video MyVideo = null;
        public Form1()
        {
            InitializeComponent();
            int height = panel1.Height;
            int width = panel1.Width;
            if (MyVideo != null)
            { MyVideo.Dispose(); }
            MyVideo = new Video("F:\\偶像派文学老师,郭敬明的价值观很贱?.avi");
            MyVideo.Owner = panel1;
            panel1.Width = width;
            panel1.Height = height;
            MyVideo.Play();
            MyVideo.Pause();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

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

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

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

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

能帮我修改下吗?万分感谢!
--------------------编程问答-------------------- up --------------------编程问答-------------------- --------------------编程问答-------------------- 来学习一下 --------------------编程问答-------------------- 期待中~~~~~ --------------------编程问答-------------------- 用
WMPLib.dll

axWindowsMediaPlayer --------------------编程问答-------------------- 要不要换个文件名试试?首先要英文的,然后把特殊符号去掉 --------------------编程问答-------------------- 我当时做的时候直接把播放器添加进去了... --------------------编程问答-------------------- 解码器不够,不能正常解码
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,