External/Aga.Controls/Tree/NativeMethods.cs
changeset 345 0c551e8818e0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/External/Aga.Controls/Tree/NativeMethods.cs	Sun May 27 15:16:19 2012 +0000
     1.3 @@ -0,0 +1,74 @@
     1.4 +using System;
     1.5 +using System.Drawing;
     1.6 +using System.Runtime.InteropServices;
     1.7 +
     1.8 +
     1.9 +namespace Aga.Controls.Tree
    1.10 +{
    1.11 +    internal static class NativeMethods
    1.12 +    {
    1.13 +        public const int DCX_WINDOW = 0x01;
    1.14 +        public const int DCX_CACHE = 0x02;
    1.15 +        public const int DCX_NORESETATTRS = 0x04;
    1.16 +        public const int DCX_CLIPCHILDREN = 0x08;
    1.17 +        public const int DCX_CLIPSIBLINGS = 0x10;
    1.18 +        public const int DCX_PARENTCLIP = 0x20;
    1.19 +        public const int DCX_EXCLUDERGN = 0x40;
    1.20 +        public const int DCX_INTERSECTRGN = 0x80;
    1.21 +        public const int DCX_EXCLUDEUPDATE = 0x100;
    1.22 +        public const int DCX_INTERSECTUPDATE = 0x200;
    1.23 +        public const int DCX_LOCKWINDOWUPDATE = 0x400;
    1.24 +        public const int DCX_VALIDATE = 0x200000;
    1.25 +
    1.26 +        public const int WM_THEMECHANGED = 0x031A;
    1.27 +        public const int WM_NCPAINT = 0x85;
    1.28 +        public const int WM_NCCALCSIZE = 0x83;
    1.29 +
    1.30 +        public const int WS_BORDER = 0x800000;
    1.31 +        public const int WS_EX_CLIENTEDGE = 0x200;
    1.32 +
    1.33 +        public const int WVR_HREDRAW = 0x100;
    1.34 +        public const int WVR_VREDRAW = 0x200;
    1.35 +        public const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW);
    1.36 +
    1.37 +        [StructLayout(LayoutKind.Sequential)]
    1.38 +        public struct NCCALCSIZE_PARAMS
    1.39 +        {
    1.40 +            public RECT rgrc0, rgrc1, rgrc2;
    1.41 +            public IntPtr lppos;
    1.42 +        }
    1.43 +
    1.44 +        [StructLayout(LayoutKind.Sequential)]
    1.45 +        public struct RECT
    1.46 +        {
    1.47 +            public int Left;
    1.48 +            public int Top;
    1.49 +            public int Right;
    1.50 +            public int Bottom;
    1.51 +
    1.52 +            public static RECT FromRectangle(Rectangle rectangle)
    1.53 +            {
    1.54 +                RECT result = new RECT();
    1.55 +                result.Left = rectangle.Left;
    1.56 +                result.Top = rectangle.Top;
    1.57 +                result.Right = rectangle.Right;
    1.58 +                result.Bottom = rectangle.Bottom;
    1.59 +                return result;
    1.60 +            }
    1.61 +
    1.62 +            public Rectangle ToRectangle()
    1.63 +            {
    1.64 +                return new Rectangle(Left, Top, Right - Left, Bottom - Top);
    1.65 +            }
    1.66 +        }
    1.67 +
    1.68 +        [DllImport("user32.dll", SetLastError = true)]
    1.69 +        public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
    1.70 +
    1.71 +        [DllImport("user32.dll")]
    1.72 +        public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
    1.73 +
    1.74 +        [DllImport("user32.dll")]
    1.75 +        public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
    1.76 +    }
    1.77 +}