internal void Dispose(bool disposing) { if (!this.disposed) { if (this.Disposing != null) { this.Disposing(this, EventArgs.Empty); } this.disposed = true; this.DisposeFont(disposing); switch (this.dcType) { case System.Windows.Forms.Internal.DeviceContextType.Unknown: case System.Windows.Forms.Internal.DeviceContextType.NCWindow: return; case System.Windows.Forms.Internal.DeviceContextType.Display: ((IDeviceContext)this).ReleaseHdc(); return; case System.Windows.Forms.Internal.DeviceContextType.NamedDevice: case System.Windows.Forms.Internal.DeviceContextType.Information: IntUnsafeNativeMethods.DeleteHDC(new HandleRef(this, this.hDC)); this.hDC = IntPtr.Zero; return; case System.Windows.Forms.Internal.DeviceContextType.Memory: IntUnsafeNativeMethods.DeleteDC(new HandleRef(this, this.hDC)); this.hDC = IntPtr.Zero; return; } } }