本文實例講述了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#程序設計有所幫助。
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!