首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >检测使用MCI命令播放的视频上的鼠标点击

检测使用MCI命令播放的视频上的鼠标点击
EN

Stack Overflow用户
提问于 2014-11-21 12:28:37
回答 1查看 186关注 0票数 0

我有一个播放视频的应用程序。我正在使用MCI播放视频,并将其附加到面板控件上。我正在捕捉鼠标在主窗体和所有控件上的点击,但当我点击MCI播放的视频时,它没有检测到鼠标点击。

如何检测使用MCI命令播放的视频中的鼠标点击?

EN

回答 1

Stack Overflow用户

发布于 2014-11-21 13:06:21

最后,我创建了一个无边框的表单,并将其传递给mci视频。我将窗体TransparencyKey设置为背景色。这样,视频仍然会显示,但鼠标单击是通过to main窗体传递的。

我从主窗体中设置窗体的大小和位置,因为由于某些原因,从窗体内部设置它们将不起作用,我仍在尝试理解原因

代码语言:javascript
复制
    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();
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27054129

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档