zoukankan      html  css  js  c++  java
  • C# 获取鼠标在屏幕上的位置

    获取鼠标位置及鼠标单击了哪个按键。
    private void GetMousePoint()
    {
         Point ms = Control.MousePosition;
         this.label2.Text = string.Format("当前鼠标位置:{0}:{1}", ms.X, ms.Y);
         MouseButtons mb = Control.MouseButtons;

        //  获取鼠标动作(按下了 那个按键)
         if (mb == System.Windows.Forms.MouseButtons.Left) this.label1.Text = "Left";           
         if (mb == System.Windows.Forms.MouseButtons.Right) this.label1.Text = "Right";
         if (mb == System.Windows.Forms.MouseButtons.Middle) this.label1.Text = "Middle";

    }

    //更新鼠标位置等信息。
    private void timer1_Tick(object sender, EventArgs e)
    {
         GetMousePoint();
    }



  • 相关阅读:
    总结!!!总结!!!
    Beta 总结
    BETA-7
    BETA-6
    BETA-5
    BETA-4
    BETA-3
    华为云-软件产品案例分析
    BETA-2
    BETA-1
  • 原文地址:https://www.cnblogs.com/snsnetw/p/12366337.html
Copyright © 2011-2022 走看看