我有一个播放视频的应用程序。我正在使用MCI播放视频,并将其附加到面板控件上。我正在捕捉鼠标在主窗体和所有控件上的点击,但当我点击MCI播放的视频时,它没有检测到鼠标点击。
如何检测使用MCI命令播放的视频中的鼠标点击?
发布于 2014-11-21 13:06:21
最后,我创建了一个无边框的表单,并将其传递给mci视频。我将窗体TransparencyKey设置为背景色。这样,视频仍然会显示,但鼠标单击是通过to main窗体传递的。
我从主窗体中设置窗体的大小和位置,因为由于某些原因,从窗体内部设置它们将不起作用,我仍在尝试理解原因
public VideoForm()
{
this.FormBorderStyle = FormBorderStyle.None;
this.TransparencyKey = Color.White;
this.TopMost = true;
}
public void PlayVideo(int width, int height, ScreenControl control)
{
string mciCommand = string.Format("open \"{0}\" Type mpegvideo alias {1} parent {2} style child", control.Location(), control.Name, this.Handle.ToString());
int error = WinApi.mciSendString(mciCommand, null, 0, IntPtr.Zero);
mciCommand = string.Format("put {0} window at 0 0 {1} {2}", control.Name, width, height);
error = WinApi.mciSendString(mciCommand, null, 0, IntPtr.Zero);
mciCommand = string.Format("seek {0} to 0", control.Name);
error = WinApi.mciSendString(mciCommand, null, 0, IntPtr.Zero);
mciCommand = string.Format("play {0} repeat", control.Name);
error = WinApi.mciSendString(mciCommand, null, 0, IntPtr.Zero);
this.Show();
}https://stackoverflow.com/questions/27054129
复制相似问题