Alsing.Drawing.GDI.GDISurface.Destroy C# (CSharp) Method

Destroy() protected method

protected Destroy ( ) : void
return void
        protected override void Destroy()
        {
            if (_OldBmp != IntPtr.Zero)
                NativeMethods.SelectObject(hDC, _OldBmp);

            if (_OldFont != IntPtr.Zero)
                NativeMethods.SelectObject(hDC, _OldFont);

            if (_OldPen != IntPtr.Zero)
                NativeMethods.SelectObject(hDC, _OldPen);

            if (_OldBrush != IntPtr.Zero)
                NativeMethods.SelectObject(hDC, _OldBrush);

            if (mhBMP != (IntPtr) 0)
                NativeMethods.DeleteObject(mhBMP);

            if (mhDC != (IntPtr) 0)
                NativeMethods.DeleteDC(mhDC);

            mhBMP = (IntPtr) 0;
            mhDC = (IntPtr) 0;


            base.Destroy();
        }