本文實例講述了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;      ///循環(huán)取點      while (true) {        Point p = System.Windows.Forms.Cursor.Position;        Console.WriteLine(p.X + ":" + p.Y);        Thread.Sleep(100);        Console.Clear();      }    }  }}更多關(guān)于C#相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《C#常見控件用法教程》、《WinForm控件用法總結(jié)》、《C#數(shù)據(jù)結(jié)構(gòu)與算法教程》、《C#面向?qū)ο蟪绦蛟O(shè)計入門教程》及《C#程序設(shè)計之線程使用技巧總結(jié)》
希望本文所述對大家C#程序設(shè)計有所幫助。
新聞熱點
疑難解答
圖片精選