public void GetWindowRectangle(out int x, out int y, out int width, out int height) { var rect = new Win32Rectangle(); Functions.GetWindowRect(this.Handle, ref rect); var parent = Functions.GetParent(this.Handle); var point = new Point(rect.Left, rect.Top); Functions.ScreenToClient(parent, ref point); x = point.X; y = point.Y; width = rect.Width; height = rect.Height; }
public static extern int FillRect(IntPtr hdc, ref Win32Rectangle rect, IntPtr intPtr);
public static extern bool GetWindowRect(IntPtr hWnd, ref Win32Rectangle rect);
public static extern bool AdjustWindowRectEx( ref Win32Rectangle lpRect, WindowStyle dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, ExtendedWindowStyle dwExStyle);