Exemple #1
0
        /// <summary>
        /// 获取视频播放窗体参数
        /// </summary>
        /// <param name="stLocalWnd"></param>
        /// <param name="stRemoteWnd"></param>
        public void GetVideoPlayPara(ref STVideoWindow stLocalWnd, ref STVideoWindow stRemoteWnd)
        {
            System.Drawing.Point phRemote = new System.Drawing.Point();
            System.Drawing.Point phLocal  = new System.Drawing.Point();
            IntPtr intpRemote             = new IntPtr();

            System.Drawing.Point plRemote = new System.Drawing.Point();
            IntPtr intpLocal = new IntPtr();

            System.Drawing.Point plLocal = new System.Drawing.Point();
            Dispatcher.Invoke(new Action(() =>
            {
                intpRemote = (host.Child as UCVideo).Remote.Handle;
                intpLocal  = (host.Child as UCVideo).Local.Handle;
                plRemote.X = 0;
                plRemote.Y = 0;
                UCInterface.ClientToScreen(intpRemote, ref plRemote);

                phRemote.X = (int)(host.Child as UCVideo).Remote.Width;
                phRemote.Y = (int)(host.Child as UCVideo).Remote.Height;
                UCInterface.ClientToScreen(intpRemote, ref phRemote);

                plLocal.X = 0;
                plLocal.Y = 0;
                UCInterface.ClientToScreen(intpLocal, ref plLocal);

                phLocal.X = (int)(host.Child as UCVideo).Local.Width;
                phLocal.Y = (int)(host.Child as UCVideo).Local.Height;
                UCInterface.ClientToScreen(intpLocal, ref phLocal);
            }));
            stRemoteWnd.height = phRemote.Y;
            stRemoteWnd.hWnd   = (int)(intpRemote);
            stRemoteWnd.left   = plRemote.X;
            stRemoteWnd.top    = plRemote.Y;
            stRemoteWnd.width  = phRemote.X;

            stLocalWnd.height = phLocal.Y;
            stLocalWnd.hWnd   = (int)(intpLocal);
            stLocalWnd.left   = plLocal.X;
            stLocalWnd.top    = plLocal.Y;
            stLocalWnd.width  = phLocal.X;
            SetWinSize();          //重新设置video尺寸
            this.isreturn = false; //modify by jinyeqing  重置Video后由于线程原因仍会进入closewinvideo    所以还是要使用这个isreturn还判断避免在updatelayout
            this.IsReturn = true;
        }