zoukankan      html  css  js  c++  java
  • AxWindowsMediaPlayer使用 分类: .NET 20120331 12:50 1644人阅读 评论(0) 收藏

    #region 判断鼠标在1分钟内是否移动
            bool ff = true;
            private void timer1_Tick_1(object sender, EventArgs e)
            {
                int x1 = Control.MousePosition.X;
                int y1 = Control.MousePosition.Y;
    
                if ((x == x1) && (y == y1) && ff)
                {
                    start = DateTime.Now;
                    ff = false;
                }
                if (x != x1 || y != y1)
                {
                    x = x1;
                    y = y1;
                    start = DateTime.Now;
                    ff = true;
                }
                this.textBox2.Text = DateTime.Now.Hour + " " + DateTime.Now.Minute + " " + DateTime.Now.Second + "              " + start.Hour + " " + start.Minute + " " + start.Second;
                TimeSpan ts = DateTime.Now.Subtract(start);
                this.textBox1.Text = ff.ToString() + " " + ts.Hours + " " + ts.Minutes + " " + ts.Seconds;
                //鼠标或键盘误动作3分钟后开始播放视频
                if (ts.Minutes >= 1)
                {
                    this.timer1.Enabled = false;
                    this.axWindowsMediaPlayer2.currentPlaylist.appendItem(this.axWindowsMediaPlayer2.newMedia(path + @"\VTS_01_1.avi"));
                    this.axWindowsMediaPlayer2.currentPlaylist.appendItem(this.axWindowsMediaPlayer2.newMedia(path + @"\录像24.avi"));
                    
                    this.axWindowsMediaPlayer2.Ctlcontrols.play();
                    this.axWindowsMediaPlayer2.Visible = true;
                    this.axWindowsMediaPlayer2.settings.setMode("loop", true);
                    this.axWindowsMediaPlayer2.StatusChange += new EventHandler(axWindowsMediaPlayer2_StatusChange);
                }
            }
    
            //正在播放、打开媒体、已停止
            bool one = true;
            void axWindowsMediaPlayer2_StatusChange(object sender, EventArgs e)
            {
                if (this.axWindowsMediaPlayer2.status == "正在播放")
                {
                    this.axWindowsMediaPlayer2.fullScreen = true;
                    //单击正在播放的视频时退出视频,并重新启用计时器检查鼠标是否移动。
                    this.axWindowsMediaPlayer2.ClickEvent += new AxWMPLib._WMPOCXEvents_ClickEventHandler(axWindowsMediaPlayer2_ClickEvent);
                }
            }
    
            void axWindowsMediaPlayer2_ClickEvent(object sender, AxWMPLib._WMPOCXEvents_ClickEvent e)
            {
                this.axWindowsMediaPlayer2.Ctlcontrols.stop();
                this.axWindowsMediaPlayer2.Visible = false;
    
                this.timer1.Enabled = true;
            }
            #endregion


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    MFC 的CLIST控件
    。。。。
    异常网
    27款经典的CSS框架 狼人:
    分析:从服务器出货情况看云发展情况 狼人:
    互联网是双刃剑 需合理把握 狼人:
    自由职业者和外包接单项目分析 狼人:
    Google发布Native Client首个开发工具包 狼人:
    MVC框架 EasyJWeb 2.0 发布 狼人:
    谷歌Chrome 11对早期开发者开放使用 狼人:
  • 原文地址:https://www.cnblogs.com/configman/p/4657594.html
Copyright © 2011-2022 走看看