Exemple #1
0
        public static Point GetCoordinateRelativeToWindow(IntPtr hWnd)
        {
            Structs.Rect rect = default(Structs.Rect);
            WinAPI.GetWindowRect(hWnd, out rect);
            Point position = Cursor.Position;
            int   x        = position.X;

            position = Cursor.Position;
            int y = position.Y;

            return(new Point(x - rect.X, y - rect.Y));
        }
Exemple #2
0
 public static Point ConvertToWindowCoordinates(IntPtr hWnd, int x, int y)
 {
     Structs.Rect rect = default(Structs.Rect);
     WinAPI.GetWindowRect(hWnd, out rect);
     return(new Point(rect.X + x, rect.Y + y));
 }
Exemple #3
0
 public static Rectangle GetDimensions(IntPtr hWnd)
 {
     Structs.Rect rect = default(Structs.Rect);
     WinAPI.GetWindowRect(hWnd, out rect);
     return(new Rectangle(rect.X, rect.Y, rect.Width, rect.Height));
 }
Exemple #4
0
 internal static extern bool GetWindowRect(IntPtr hWnd, out Structs.Rect lpRect);