日期:2014-05-17  浏览次数:20852 次

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();
            }
        }
    }
}