首页 新闻 会员 周边

.【急!!!】C#移动视频控件出现闪屏【求大神帮忙】

0
悬赏园豆:20 [已关闭问题] 关闭于 2013-11-28 15:05

   public Form1()
        {
            InitializeComponent();
            this.DoubleBuffered = true;//设置本窗体
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
            SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲

        }
        
        //切换视频
        int channelNum = 0;//摄像头频道个数
        private void btnChange_Click(object sender, EventArgs e)
        {
            #region 摄像头
              int userID = aNVCurr.Login();
            aNVCurr.SetUserID(userID);
            aNVPre.SetUserID(userID);
            aNVCurr.StartRealPlay(0, 0, 0);
            aNVPre.StartRealPlay(1, 0, 0);
            #endregion

            if (showVideo == 1)
            {
                aNVPre.Left = aNVCurr.Left - aNVPre.Width;//第二个视频的左坐标
               
            }
            else
            {
                aNVCurr.Left = aNVPre.Left - aNVCurr.Width;
                
            }
            timer1.Enabled = true;
        }
        
        int showVideo = 1;
        
        #region 移动视频
        private void timer1_Tick(object sender, EventArgs e)
        {
           
            if (showVideo == 1)//第一个视频
            {
                if (aNVPre.Left < 0)
                {
                    aNVPre.BringToFront();
                    aNVPre.Left += VideoPl.Width / 100;//移动第二个视频
                   
                }
                else
                {
                    showVideo = 2;
                    aNVPre.Left = 0;
                    timer1.Enabled = false;
                   
                }
            }
            else//第二个视频
            {
                if (aNVCurr.Left < 0)
                {
                    aNVCurr.BringToFront();
                    aNVCurr.Left += VideoPl.Width / 100;//移动第一个视频
                }
                else
                {
                    showVideo = 1;
                    aNVCurr.Left = 0;
                    timer1.Enabled = false;
                    
                }
            }
        }
        #endregion

摩天轮的幸福的主页 摩天轮的幸福 | 菜鸟二级 | 园豆:202
提问于:2013-04-27 10:47
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册