/// <summary>
        /// Disposes the DC, but leaves the bitmap alone.
        /// </summary>
        private void DisposeDC()
        {
            if (_oldBitmap != IntPtr.Zero && _compatDC != IntPtr.Zero)
            {
                SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _oldBitmap));
                _oldBitmap = IntPtr.Zero;
            }

            if (_compatDC != IntPtr.Zero)
            {
                UnsafeNativeMethods.DeleteDC(new HandleRef(this, _compatDC));
                _compatDC = IntPtr.Zero;
            }
        }
 private void DisposeDC()
 {
     if (oldBitmap != IntPtr.Zero && compatDC != IntPtr.Zero)
     {
         Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "restoring bitmap to DC");
         SafeNativeMethods.SelectObject(new HandleRef(this, compatDC), new HandleRef(this, oldBitmap));
         oldBitmap = IntPtr.Zero;
     }
     if (compatDC != IntPtr.Zero)
     {
         Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete compat DC");
         UnsafeNativeMethods.DeleteDC(new HandleRef(this, compatDC));
         compatDC = IntPtr.Zero;
     }
 }