溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

C#簡(jiǎn)單獲取全屏中鼠標(biāo)焦點(diǎn)位置坐標(biāo)的方法示例

發(fā)布時(shí)間:2020-09-20 11:20:05 來(lái)源:腳本之家 閱讀:356 作者:a771948524 欄目:編程語(yǔ)言

本文實(shí)例講述了C#簡(jiǎn)單獲取全屏中鼠標(biāo)焦點(diǎn)位置坐標(biāo)的方法。分享給大家供大家參考,具體如下:

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)取點(diǎ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#常見(jiàn)控件用法教程》、《WinForm控件用法總結(jié)》、《C#數(shù)據(jù)結(jié)構(gòu)與算法教程》、《C#面向?qū)ο蟪绦蛟O(shè)計(jì)入門(mén)教程》及《C#程序設(shè)計(jì)之線程使用技巧總結(jié)》

希望本文所述對(duì)大家C#程序設(shè)計(jì)有所幫助。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI