Esempio n. 1
0
        public void ResizeWindowToVideo()
        {
            IVideoWindow pVW = m_pRenderGraph as IVideoWindow;
            IBasicVideo  pBV = m_pRenderGraph as IBasicVideo;

            if ((pVW != null) && (pBV != null))
            {
                // size of new video
                int cx, cy;
                pBV.GetVideoSize(out cx, out cy);
                DsRect rcVideo = new DsRect(0, 0, cx, cy);

                // adjust from client size to window size
                WindowStyle style;
                pVW.get_WindowStyle(out style);
                //AdjustWindowRect(rcVideo, style, false);

                // get current window top/left
                int    cxWindow, cyWindow;
                DsRect rc = new DsRect();
                pVW.GetWindowPosition(out rc.left, out rc.top, out cxWindow, out cyWindow);

                // reposition video window with old top/left position and new size
                pVW.SetWindowPosition(rc.left, rc.top, rcVideo.right - rcVideo.left, rcVideo.bottom - rcVideo.top);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Configures our "dummy" IVideoWindow to work well
        /// with our interactive menus and to make sure the
        /// window remains hidden from view.
        /// </summary>
        private void ConfigureDummyWindow()
        {
            /* We want to hide our dummy renderer window */
            int hr = m_dummyRenderWindow.put_WindowState(WindowState.Hide);

            DsError.ThrowExceptionForHR(hr);

            WindowStyle windowStyle;

            /* Get the current style of the window */
            m_dummyRenderWindow.get_WindowStyle(out windowStyle);
            DsError.ThrowExceptionForHR(hr);

            /* Remove these styles using bitwise magic */
            windowStyle &= ~WindowStyle.SysMenu;
            windowStyle &= ~WindowStyle.Caption;
            windowStyle &= ~WindowStyle.Border;

            /* Change the window to our new style */
            hr = m_dummyRenderWindow.put_WindowStyle(windowStyle);
            DsError.ThrowExceptionForHR(hr);

            /* This should hide the window from view */
            hr = m_dummyRenderWindow.put_Visible(OABool.False);
            DsError.ThrowExceptionForHR(hr);

            /* Turn off auto show, so the renderer doesn't try to show itself */
            hr = m_dummyRenderWindow.put_AutoShow(OABool.False);
            DsError.ThrowExceptionForHR(hr);
        }
Esempio n. 3
0
        ////////////
        /// Test Get/Put WindowStyle
        private void TestWindowStyle()
        {
            int         hr;
            WindowStyle ws1, ws2;

            // Read the current style
            hr = m_ivw.get_WindowStyle(out ws1);
            Marshal.ThrowExceptionForHR(hr);

            // Flip the caption bit
            ws1 ^= WindowStyle.Caption;

            // Write the changed style
            hr = m_ivw.put_WindowStyle(ws1);
            Marshal.ThrowExceptionForHR(hr);

            // Read the style
            hr = m_ivw.get_WindowStyle(out ws2);
            Marshal.ThrowExceptionForHR(hr);

            // Make sure the value we set is what we just read
            Debug.Assert(ws1 == ws2, "Put/Get WindowStyle");
        }