using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Drawing; namespace DevComponents.DotNetBar.Layout.Design { internal static class WinApi { [DllImport("gdi32.dll", CharSet = CharSet.Auto)] public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject); [DllImport("gdi32")] public static extern bool DeleteObject(IntPtr hObject); [DllImport("gdi32.dll", CharSet = CharSet.Auto)] public static extern bool GetTextMetrics(HandleRef hdc, TEXTMETRIC tm); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public class TEXTMETRIC { public int tmHeight; public int tmAscent; public int tmDescent; public int tmInternalLeading; public int tmExternalLeading; public int tmAveCharWidth; public int tmMaxCharWidth; public int tmWeight; public int tmOverhang; public int tmDigitizedAspectX; public int tmDigitizedAspectY; public char tmFirstChar; public char tmLastChar; public char tmDefaultChar; public char tmBreakChar; public byte tmItalic; public byte tmUnderlined; public byte tmStruckOut; public byte tmPitchAndFamily; public byte tmCharSet; } [DllImport("user32")] public static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); [DllImport("user32")] public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); public const int WM_SETREDRAW = 0x000B; public const int WM_LBUTTONDOWN = 0x0201; public const int WM_LBUTTONUP = 0x0202; public const int WM_RBUTTONDOWN = 0x0204; public const int WM_RBUTTONUP = 0x0205; public const int WM_MOUSEMOVE = 0x0200; public const int WM_MOUSELEAVE = 0x02A3; public const int WM_HSCROLL = 0x0114; public const int WM_VSCROLL = 0x0115; public const int WM_LBUTTONDBLCLK = 0x0203; public static int LOWORD(int n) { return (short)(n & 0xffff); } public static int HIWORD(int n) { return (int)((n >> 0x10) & 0xffff); } public static int LOWORD(IntPtr n) { return LOWORD((int)((long)n)); } public static int HIWORD(IntPtr n) { return unchecked((short)((uint)n >> 16)); } //[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] //public static extern int ScrollWindowEx(HandleRef hWnd, int nXAmount, int nYAmount, ref RECT rectScrollRegion, ref RECT rectClip, IntPtr hrgnUpdate, ref RECT prcUpdate, int flags); //[StructLayout(LayoutKind.Sequential)] //public struct RECT //{ // public int left; // public int top; // public int right; // public int bottom; // public RECT(int left, int top, int right, int bottom) // { // this.left = left; // this.top = top; // this.right = right; // this.bottom = bottom; // } // public RECT(Rectangle r) // { // this.left = r.Left; // this.top = r.Top; // this.right = r.Right; // this.bottom = r.Bottom; // } // public static RECT FromXYWH(int x, int y, int width, int height) // { // return new RECT(x, y, x + width, y + height); // } // public Size Size // { // get // { // return new Size(this.right - this.left, this.bottom - this.top); // } // } //} } }