/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (_Handle != IntPtr.Zero) { if (Wgl.CurrentExtensions.Pbuffer_ARB) { bool res = Wgl.DestroyPbufferARB(_Handle); Debug.Assert(res); } else { bool res = Wgl.DestroyPbufferEXT(_Handle); Debug.Assert(res); } _Handle = IntPtr.Zero; } if (_DeviceContext != IntPtr.Zero) { Wgl.ReleaseDC(IntPtr.Zero, _DeviceContext); _DeviceContext = IntPtr.Zero; } }
/// <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); }