Export to GitHub

gong-wpf-dragdrop - issue #51

Detecting cursor position


Posted on Jun 7, 2013 by Swift Kangaroo

This code helpswith errors, occured when draging from one window to another

public static class MousePositionHelper { private static class NativeMethods { [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; }

  [DllImport("user32.dll")]
  public static extern bool GetCursorPos(out POINT lpPoint);
}

public static Point GetCursorPosition()
{
  NativeMethods.POINT point;
  NativeMethods.GetCursorPos(out point);
  return new Point(point.X, point.Y);      
}

}

Status: New

Labels:
Type-Defect Priority-Medium