我使用Microsoft.DirectX.AudioVideoPlayback写了一个小程序,用来顺序,循环播放一些视频文件,并且是全屏播放。我的问题是,尽管我设置了属性Fullscreen=true; 但是播放的时候还是会跳到非全屏的窗口。郁闷!!!代码如下:using System;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Video myVideo;
private Video myVideo1; private int currentIndex = 0;
private bool PrimaryVideoPlaying = true; private string[] pl = { "c:\\media\\a.mpg", "c:\\media\\b.mpg", "c:\\media\\c.mpg" };
public Form1()
{
InitializeComponent(); PlayList();
} private void PlayList()
{
currentIndex = 0;
if (pl.Length > 0)
{
PlayMedia(pl[currentIndex]);
}
} private void PlayMedia(string fileName)
{
try
{
if (PrimaryVideoPlaying)
{
PrimaryVideoPlaying = false; if (myVideo1 != null)
myVideo1.Dispose(); myVideo1 = new Video(fileName);
myVideo1.Ending += new EventHandler(myVideo_Ending);
myVideo1.Owner = this;
myVideo1.Play();
myVideo1.Fullscreen = true;
}
else
{
PrimaryVideoPlaying = true; if (myVideo != null)
myVideo.Dispose(); myVideo = new Video(fileName);
myVideo.Ending += new EventHandler(myVideo_Ending);
myVideo.Owner = this;
myVideo.Play();
myVideo.Fullscreen = true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} void myVideo_Ending(object sender, EventArgs e)
{
currentIndex = (currentIndex + 1) % pl.Length; ((Video)sender).Ending -= new EventHandler(myVideo_Ending); PlayMedia(pl[currentIndex]);
}
}
}
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Video myVideo;
private Video myVideo1; private int currentIndex = 0;
private bool PrimaryVideoPlaying = true; private string[] pl = { "c:\\media\\a.mpg", "c:\\media\\b.mpg", "c:\\media\\c.mpg" };
public Form1()
{
InitializeComponent(); PlayList();
} private void PlayList()
{
currentIndex = 0;
if (pl.Length > 0)
{
PlayMedia(pl[currentIndex]);
}
} private void PlayMedia(string fileName)
{
try
{
if (PrimaryVideoPlaying)
{
PrimaryVideoPlaying = false; if (myVideo1 != null)
myVideo1.Dispose(); myVideo1 = new Video(fileName);
myVideo1.Ending += new EventHandler(myVideo_Ending);
myVideo1.Owner = this;
myVideo1.Play();
myVideo1.Fullscreen = true;
}
else
{
PrimaryVideoPlaying = true; if (myVideo != null)
myVideo.Dispose(); myVideo = new Video(fileName);
myVideo.Ending += new EventHandler(myVideo_Ending);
myVideo.Owner = this;
myVideo.Play();
myVideo.Fullscreen = true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} void myVideo_Ending(object sender, EventArgs e)
{
currentIndex = (currentIndex + 1) % pl.Length; ((Video)sender).Ending -= new EventHandler(myVideo_Ending); PlayMedia(pl[currentIndex]);
}
}
}
解决方案 »
- ODBC插入异常 如果值是这样的肯定报错 那有办法解决吗 ODBC不支持带参数传入
- WCF的异步方法为什么没有生成?
- C#调用VC++的DLL,函数参数或返回值为CString
- 高人达人进来帮看一下我想把数据库记录生成xml格式
- 提问提问---不调试,写出此程序段的输出
- 如何在winform中打开word文档
- C#里面如何使用第三方控件?
- 新手提问:wince开发的几个问题。
- Setup Factory 7.0打包成安装文件发给客户,客户机器上没安装access怎么办?
- 如何在窗本中如加入控件一样,加入一条横线或是竖线?
- IE6 中 document.body为空或不是对象
- 求教高手,想实现:点击listbox某项后在picturebox相应坐标上绘制一个点
这个只能仔细调试下了,一步一步跟踪,看看哪里myVideo1.Fullscreen = false了
我应该怎么实现?谢谢