moel@345: using System;
moel@345: using System.Drawing;
moel@345: using System.Runtime.InteropServices;
moel@345: 
moel@345: 
moel@345: namespace Aga.Controls.Tree
moel@345: {
moel@345:     internal static class NativeMethods
moel@345:     {
moel@345:         public const int DCX_WINDOW = 0x01;
moel@345:         public const int DCX_CACHE = 0x02;
moel@345:         public const int DCX_NORESETATTRS = 0x04;
moel@345:         public const int DCX_CLIPCHILDREN = 0x08;
moel@345:         public const int DCX_CLIPSIBLINGS = 0x10;
moel@345:         public const int DCX_PARENTCLIP = 0x20;
moel@345:         public const int DCX_EXCLUDERGN = 0x40;
moel@345:         public const int DCX_INTERSECTRGN = 0x80;
moel@345:         public const int DCX_EXCLUDEUPDATE = 0x100;
moel@345:         public const int DCX_INTERSECTUPDATE = 0x200;
moel@345:         public const int DCX_LOCKWINDOWUPDATE = 0x400;
moel@345:         public const int DCX_VALIDATE = 0x200000;
moel@345: 
moel@345:         public const int WM_THEMECHANGED = 0x031A;
moel@345:         public const int WM_NCPAINT = 0x85;
moel@345:         public const int WM_NCCALCSIZE = 0x83;
moel@345: 
moel@345:         public const int WS_BORDER = 0x800000;
moel@345:         public const int WS_EX_CLIENTEDGE = 0x200;
moel@345: 
moel@345:         public const int WVR_HREDRAW = 0x100;
moel@345:         public const int WVR_VREDRAW = 0x200;
moel@345:         public const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW);
moel@345: 
moel@345:         [StructLayout(LayoutKind.Sequential)]
moel@345:         public struct NCCALCSIZE_PARAMS
moel@345:         {
moel@345:             public RECT rgrc0, rgrc1, rgrc2;
moel@345:             public IntPtr lppos;
moel@345:         }
moel@345: 
moel@345:         [StructLayout(LayoutKind.Sequential)]
moel@345:         public struct RECT
moel@345:         {
moel@345:             public int Left;
moel@345:             public int Top;
moel@345:             public int Right;
moel@345:             public int Bottom;
moel@345: 
moel@345:             public static RECT FromRectangle(Rectangle rectangle)
moel@345:             {
moel@345:                 RECT result = new RECT();
moel@345:                 result.Left = rectangle.Left;
moel@345:                 result.Top = rectangle.Top;
moel@345:                 result.Right = rectangle.Right;
moel@345:                 result.Bottom = rectangle.Bottom;
moel@345:                 return result;
moel@345:             }
moel@345: 
moel@345:             public Rectangle ToRectangle()
moel@345:             {
moel@345:                 return new Rectangle(Left, Top, Right - Left, Bottom - Top);
moel@345:             }
moel@345:         }
moel@345: 
moel@345:         [DllImport("user32.dll", SetLastError = true)]
moel@345:         public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
moel@345: 
moel@345:         [DllImport("user32.dll")]
moel@345:         public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
moel@345: 
moel@345:         [DllImport("user32.dll")]
moel@345:         public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
moel@345:     }
moel@345: }