public static Rectangle GetPositionSize(IntPtr hwnd) { var info = new tagWINDOWINFO(); info.cbSize = (uint)Marshal.SizeOf(info); GetWindowInfo(hwnd, ref info); var rect = new Rectangle(); rect.X = info.rcWindow.left; rect.Y = info.rcWindow.top; rect.Width = info.rcWindow.right - info.rcWindow.left; rect.Height = info.rcWindow.bottom - info.rcWindow.top; return rect; }
public static Rectangle GetSize(IntPtr hwnd) { var info = new tagWINDOWINFO(); info.cbSize = (uint)Marshal.SizeOf(info); var returnRectangle = new Rectangle(); GetWindowInfo(hwnd, ref info); returnRectangle.X = info.rcClient.left; returnRectangle.Y = info.rcClient.top; returnRectangle.Width = info.rcClient.right - returnRectangle.X; returnRectangle.Height = info.rcClient.bottom - returnRectangle.Y; return(returnRectangle); }
public static Rectangle GetPositionSize(IntPtr hwnd) { var info = new tagWINDOWINFO(); info.cbSize = (uint)Marshal.SizeOf(info); GetWindowInfo(hwnd, ref info); var rect = new Rectangle(); rect.X = info.rcWindow.left; rect.Y = info.rcWindow.top; rect.Width = info.rcWindow.right - info.rcWindow.left; rect.Height = info.rcWindow.bottom - info.rcWindow.top; return(rect); }
private static extern bool GetWindowInfo(IntPtr hwnd, ref tagWINDOWINFO pwi);
public static Rectangle GetSize(IntPtr hwnd) { var info = new tagWINDOWINFO(); info.cbSize = (uint) Marshal.SizeOf(info); var returnRectangle = new Rectangle(); GetWindowInfo(hwnd, ref info); returnRectangle.X = info.rcClient.left; returnRectangle.Y = info.rcClient.top; returnRectangle.Width = info.rcClient.right - returnRectangle.X; returnRectangle.Height = info.rcClient.bottom - returnRectangle.Y; return returnRectangle; }