Пример #1
0
        void _detachedWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_evr != null || _vw != null)
            {
                // put the video window back to this control
                _isInit = false;
                InitVideoWindow(this.Handle);
            }

            _detachedWindow.Dispose();
            _detachedWindow = null;

            // force resize to repaint the frame of video in the Node
            VideoInternalWindow_Resize(null, null);
        }
Пример #2
0
        public Form DetachVideoWindow(bool fullscreen)
        {
            if (!_isInit)
            {
                return(null);
            }

            //if we're already deteched, close the form
            if (_detachedWindow != null)
            {
                _detachedWindow.Close();
                return(null);
            }

            _detachedWindow              = new DetachedVideoWindow(this);
            _detachedWindow.Size         = new Size(320, 240);
            _detachedWindow.BackColor    = Color.Black;
            _detachedWindow.Text         = _filterName;
            _detachedWindow.FormClosing += new FormClosingEventHandler(_detachedWindow_FormClosing);
            _detachedWindow.Resize      += new EventHandler(VideoInternalWindow_Resize);
            _detachedWindow.Paint       += new PaintEventHandler(VideoInternalWindow_Paint);
            _detachedWindow.MouseMove   += new MouseEventHandler(VideoInternalWindow_MouseMove);
            _detachedWindow.MouseDown   += new MouseEventHandler(VideoInternalWindow_MouseDown);
            _detachedWindow.Icon         = (this.TopLevelControl as Form).Icon;

            // if we're going full screen, we're going to fake the funk with a fullscreen window
            if (fullscreen)
            {
                _detachedWindow.FullScreen = true;
            }
            _detachedWindow.Show(this.TopLevelControl);

            // reset the video initialization
            _isInit = false;
            InitVideoWindow(_detachedWindow.Handle);

            // if it's a vmr7 or vmr9, sned it's message drain through the detached window
            if (_vw != null)
            {
                int hr = _vw.put_MessageDrain(_detachedWindow.Handle);
            }

            return(_detachedWindow);
        }