/// -----------------------------------------------------------------------------------
        /// <summary>
        /// Uninitialize the graphics object by releasing the DC.
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public void Uninit()
        {
            CheckDisposed();

            if (m_cactInitGraphics > 0)
            {
                Debug.Assert(m_vwGraphics != null);
                Debug.Assert(m_graphics != null);
                m_cactInitGraphics--;
                // JohnT: Should be redundant to test for m_graphics null, but see comments above
                // and LTB-708.
                if (m_cactInitGraphics == 0 && m_vwGraphics != null && m_graphics != null)
                {
                    // We have released as often as we init'd. The device context must have been
                    // made in InitGraphics. Release it.
                    IntPtr hdc = m_vwGraphics.GetDeviceContext();
                    m_vwGraphics.ReleaseDC();
                    if (hdc != IntPtr.Zero)
                    {
                        m_graphics.ReleaseHdc(hdc);
                    }

                    m_graphics.Dispose();
                    m_graphics = null;
                }
            }
        }
Beispiel #2
0
        void Dispose(bool properly)
        {
            // Can't do anything sensible if called from destructor; nothing to do if somehow called twice.
            if (!properly || m_graphics == null)
            {
                return;
            }
            IntPtr hdc = m_vwGraphics.GetDeviceContext();

            m_vwGraphics.ReleaseDC();
            if (hdc != IntPtr.Zero)
            {
                m_graphics.ReleaseHdc(hdc);
            }
            m_vwGraphics = null;
            if (m_shouldDisposeGraphics)
            {
                m_graphics.Dispose();
            }
            m_graphics = null;
        }
Beispiel #3
0
 protected void ProcessGetDeviceContext()
 {
     m_vwGraphics32.GetDeviceContext();
 }