zoukankan      html  css  js  c++  java
  • GetCursorPos

     



    获取桌面坐标



    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            #region
         
            [DllImport("user32.dll", CharSet = CharSet.Auto)]
            public static extern bool GetCursorPos(out POINT pt);
            [StructLayout(LayoutKind.Sequential)]
            public struct POINT
            {
                public int X;
                public int Y;
                public POINT(int x, int y)
                {
                    this.X = x;
                    this.Y = y;
                }
            }
            #endregion

            private void timer1_Tick(object sender, EventArgs e)
            {
                POINT pt = new POINT();
                GetCursorPos(out pt);
                textBox1.Text = string.Format("{0},{1}", pt.X,pt.Y);
            }
        }
    }





    附件列表

    • 相关阅读:
      【NOIP2018】游记
      题解 P1441 【砝码称重】
      题解 P3128 【[USACO15DEC]最大流Max Flow】
      题解 P1949 【聪明的打字员_NOI导刊2011提高(10)】
      题解 P1966 【火柴排队】
      题解 P1895 【数字序列】
      topcoder做题
      1149E
      hdu 6589
      hdu 6579
    • 原文地址:https://www.cnblogs.com/xe2011/p/6094532.html
    Copyright © 2011-2022 走看看