public static void CreateRegion(IntPtr hWnd, int radius, RoundStyle roundStyle, bool redraw) { Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); Rectangle rect = new Rectangle(System.Drawing.Point.Empty, lpRect.Size); if (roundStyle != RoundStyle.None) { using (GraphicsPath path = GraphicsPathHelper.CreatePath(rect, radius, roundStyle, true)) { using (Region region = new Region(path)) { path.Widen(Pens.White); region.Union(path); IntPtr windowDC = Win32.NativeMethods.GetWindowDC(hWnd); try { using (Graphics graphics = Graphics.FromHdc(windowDC)) { Win32.NativeMethods.SetWindowRgn(hWnd, region.GetHrgn(graphics), redraw); } } finally { Win32.NativeMethods.ReleaseDC(hWnd, windowDC); } } return; } } IntPtr hRgn = Win32.NativeMethods.CreateRectRgn(0, 0, rect.Width, rect.Height); Win32.NativeMethods.SetWindowRgn(hWnd, hRgn, redraw); }
public TOOLINFO(int flags) { this.cbSize = Marshal.SizeOf(typeof(TOOLINFO)); this.uFlags = flags; this.hwnd = IntPtr.Zero; this.uId = IntPtr.Zero; this.rect = new RECT(0, 0, 0, 0); this.hinst = IntPtr.Zero; this.lpszText = IntPtr.Zero; this.lParam = IntPtr.Zero; }
internal void CheckBounds(IntPtr hWnd) { Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.Struct.RECT rect2 = new Win32.Struct.RECT(); Win32.NativeMethods.GetWindowRect(base.Handle, ref rect2); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); uint flags = 0x214; if (!Win32.NativeMethods.EqualRect(ref lpRect, ref rect2)) { Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(lpRect.Left, lpRect.Top); Win32.NativeMethods.ScreenToClient(Win32.NativeMethods.GetParent(base.Handle), ref lpPoint); Win32.NativeMethods.SetWindowPos(base.Handle, IntPtr.Zero, lpPoint.x, lpPoint.y, lpRect.Right - lpRect.Left, lpRect.Bottom - lpRect.Top, flags); } }
internal void CreateParamsInternal(IntPtr hWnd) { IntPtr parent = Win32.NativeMethods.GetParent(hWnd); Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); lpPoint.x = lpRect.Left; lpPoint.y = lpRect.Top; Win32.NativeMethods.ScreenToClient(parent, ref lpPoint); int num = 0x5400000d; int num2 = 0x88; this._createParams = new System.Windows.Forms.CreateParams(); this._createParams.Parent = parent; this._createParams.ClassName = "STATIC"; this._createParams.Caption = null; this._createParams.Style = num; this._createParams.ExStyle = num2; this._createParams.X = lpPoint.x; this._createParams.Y = lpPoint.y; this._createParams.Width = lpRect.Right - lpRect.Left; this._createParams.Height = lpRect.Bottom - lpRect.Top; }
public static extern bool PtInRect(ref RECT lprc, Point pt);
public static extern bool AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
public static extern bool ValidateRect(IntPtr hWnd, ref RECT lpRect);
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref RECT lParam);
public static extern int RtlMoveMemory(ref UILibrary.Win32.Struct.POINT destination, ref RECT Source, int length);
public static extern bool RedrawWindow(IntPtr hWnd, ref RECT rectUpdate, IntPtr hrgnUpdate, int flags);
public static extern int OffsetRect(ref RECT lpRect, int x, int y);
public static extern bool InvalidateRect(IntPtr hWnd, ref RECT rect, bool erase);
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
public static extern bool GetClientRect(IntPtr hWnd, ref RECT r);