using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; namespace HOZProject { /// /// Class NativeMethods. /// internal class NativeMethods { /// /// Enum ComboBoxButtonState /// public enum ComboBoxButtonState { /// /// The state system none /// STATE_SYSTEM_NONE, /// /// The state system invisible /// STATE_SYSTEM_INVISIBLE = 32768, /// /// The state system pressed /// STATE_SYSTEM_PRESSED = 8 } /// /// Struct RECT /// public struct RECT { /// /// The left /// public int Left; /// /// The top /// public int Top; /// /// The right /// public int Right; /// /// The bottom /// public int Bottom; /// /// Gets the rect. /// /// The rect. public Rectangle Rect { get { return new Rectangle(this.Left, this.Top, this.Right - this.Left, this.Bottom - this.Top); } } /// /// Gets the size. /// /// The size. public Size Size { get { return new Size(this.Right - this.Left, this.Bottom - this.Top); } } /// /// Initializes a new instance of the struct. /// /// The left. /// The top. /// The right. /// The bottom. public RECT(int left, int top, int right, int bottom) { this.Left = left; this.Top = top; this.Right = right; this.Bottom = bottom; } /// /// Initializes a new instance of the struct. /// /// The rect. public RECT(Rectangle rect) { this.Left = rect.Left; this.Top = rect.Top; this.Right = rect.Right; this.Bottom = rect.Bottom; } /// /// Froms the xywh. /// /// The x. /// The y. /// The width. /// The height. /// NativeMethods.RECT. public static NativeMethods.RECT FromXYWH(int x, int y, int width, int height) { return new NativeMethods.RECT(x, y, x + width, y + height); } /// /// Froms the rectangle. /// /// The rect. /// NativeMethods.RECT. public static NativeMethods.RECT FromRectangle(Rectangle rect) { return new NativeMethods.RECT(rect.Left, rect.Top, rect.Right, rect.Bottom); } } /// /// Struct PAINTSTRUCT /// public struct PAINTSTRUCT { /// /// The HDC /// public IntPtr hdc; /// /// The f erase /// public int fErase; /// /// The rc paint /// public NativeMethods.RECT rcPaint; /// /// The f restore /// public int fRestore; /// /// The f inc update /// public int fIncUpdate; /// /// The reserved1 /// public int Reserved1; /// /// The reserved2 /// public int Reserved2; /// /// The reserved3 /// public int Reserved3; /// /// The reserved4 /// public int Reserved4; /// /// The reserved5 /// public int Reserved5; /// /// The reserved6 /// public int Reserved6; /// /// The reserved7 /// public int Reserved7; /// /// The reserved8 /// public int Reserved8; } /// /// Struct ComboBoxInfo /// public struct ComboBoxInfo { /// /// The cb size /// public int cbSize; /// /// The rc item /// public NativeMethods.RECT rcItem; /// /// The rc button /// public NativeMethods.RECT rcButton; /// /// The state button /// public NativeMethods.ComboBoxButtonState stateButton; /// /// The HWND combo /// public IntPtr hwndCombo; /// /// The HWND edit /// public IntPtr hwndEdit; /// /// The HWND list /// public IntPtr hwndList; } /// /// The wm paint /// public const int WM_PAINT = 15; /// /// The wm setredraw /// public const int WM_SETREDRAW = 11; /// /// The false /// public static readonly IntPtr FALSE = IntPtr.Zero; /// /// The true /// public static readonly IntPtr TRUE = new IntPtr(1); /// /// Gets the ComboBox information. /// /// The HWND combo. /// The information. /// true if XXXX, false otherwise. [DllImport("user32.dll")] public static extern bool GetComboBoxInfo(IntPtr hwndCombo, ref NativeMethods.ComboBoxInfo info); /// /// Gets the window rect. /// /// The HWND. /// The lp rect. /// System.Int32. [DllImport("user32.dll")] public static extern int GetWindowRect(IntPtr hwnd, ref NativeMethods.RECT lpRect); /// /// Begins the paint. /// /// The h WND. /// The ps. /// IntPtr. [DllImport("user32.dll")] public static extern IntPtr BeginPaint(IntPtr hWnd, ref NativeMethods.PAINTSTRUCT ps); /// /// Ends the paint. /// /// The h WND. /// The ps. /// true if XXXX, false otherwise. [DllImport("user32.dll")] public static extern bool EndPaint(IntPtr hWnd, ref NativeMethods.PAINTSTRUCT ps); /// /// Sends the message. /// /// The h WND. /// The MSG. /// The w parameter. /// The l parameter. [DllImport("user32.dll")] public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); } }