1. PointToScreen(Mouse.GetPosition(this));
  2. Win32 API GetCursorPos

         用法:

     [StructLayout(LayoutKind.Sequential)]
        public struct POINTt
        {
            public int X;
            public int Y;

 

            public POINTt(int x, int y)
            {
                this.X = x;
                this.Y = y;
            }
        }

 

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetCursorPos(out POINTt pt);

 

       例子:

     POINTt pp = new POINTt();
         GetCursorPos(out pp);
         Point p = new Point(pp.X, pp.Y);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
  • 2021-05-29
  • 2022-12-23
  • 2021-12-07
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2022-01-12
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案