您的位置:首页 > 编程语言 > C#

Transparent Desktop Video C#实现透明桌面视频播放源代码

2010-03-24 11:51 447 查看
[DllImport("user32.dll", SetLastError=true)]
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", SetLastError=true)]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

private const int  GWL_EXSTYLE = -20;
private const int  WS_EX_TRANSPARENT = 0x20;

private void VideoPlayer_Load(object sender, System.EventArgs e)
{
// Add WS_EX_TRANSPARENT style so that mouse, keyboard etc. events pass

// thru us.

int exstyle = GetWindowLong(this.Handle, GWL_EXSTYLE);
exstyle |= WS_EX_TRANSPARENT;
SetWindowLong(this.Handle, GWL_EXSTYLE, exstyle);
}
[/code]
本程序是一个简单的WinForm程序,它实现了透明地播放视频,也就是说你在看视频的同时,不影响你对其它应用

程序的任何操作。视频数据源可以来自一个视频文件或在线捕捉设备。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: