ReleaseDC() private method

private ReleaseDC ( IntPtr hwnd, IntPtr hDC ) : int
hwnd System.IntPtr
hDC System.IntPtr
return int
Example #1
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_NCCALCSIZE:
                WmNCCalcSize(ref m);
                break;

            case WM_NCPAINT:
                IntPtr hDC = HeaderPanelNativeMethods.GetWindowDC(m.HWnd);
                if (hDC != IntPtr.Zero)
                {
                    using (Graphics canvas = Graphics.FromHdc(hDC))
                    {
                        PaintNonClientArea(canvas);
                    }
                    HeaderPanelNativeMethods.ReleaseDC(m.HWnd, hDC);
                }
                m.Result = IntPtr.Zero;
                break;
            }
            base.WndProc(ref m);
        }