/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting managed/unmanaged resources. /// </summary> /// <param name="disposing"> /// A <see cref="System.Boolean"/> indicating whether the disposition is requested explictly. /// </param> protected override void Dispose(bool disposing) { if (disposing) { // Release device context if (_DeviceContext != IntPtr.Zero) { if (_DeviceContextPBuffer == false) { bool res = Wgl.ReleaseDC(_WindowHandle, _DeviceContext); Debug.Assert(res); } else { int res = Wgl.ReleasePbufferDCARB(_WindowHandle, _DeviceContext); Debug.Assert(res == 1); } _DeviceContext = IntPtr.Zero; _WindowHandle = IntPtr.Zero; } } // Base implementation base.Dispose(disposing); }