欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C#简单获取全屏中鼠标焦点位置坐标的方法示例

程序员文章站 2023-12-01 11:35:40
本文实例讲述了c#简单获取全屏中鼠标焦点位置坐标的方法。分享给大家供大家参考,具体如下: using system; using system.collecti...

本文实例讲述了c#简单获取全屏中鼠标焦点位置坐标的方法。分享给大家供大家参考,具体如下:

using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.drawing;
using system.threading;
namespace consoleapplication1
{
  class program
  {
    static void main(string[] args)
    {
      ///获取桌面大小
      //rectangle rect = system.windows.forms.systeminformation.virtualscreen;
      //int width = rect.width;
      //int height = rect.height;
      ///循环取点
      while (true) {
        point p = system.windows.forms.cursor.position;
        console.writeline(p.x + ":" + p.y);
        thread.sleep(100);
        console.clear();
      }
    }
  }
}

更多关于c#相关内容感兴趣的读者可查看本站专题:《c#常见控件用法教程》、《winform控件用法总结》、《c#数据结构与算法教程》、《c#面向对象程序设计入门教程》及《c#程序设计之线程使用技巧总结

希望本文所述对大家c#程序设计有所帮助。