日期:2014-05-18  浏览次数:20931 次

判断鼠标是否按下.
判断鼠标是否按下.

------解决方案--------------------
mouse.mousedown()
------解决方案--------------------
You may use Control.MouseButtons to detect mouse button status.

C# code

    public partial class Form1 : Form
    {
        Timer timer = new Timer();
        public Form1()
        {
            InitializeComponent();
            timer.Interval = 100;
            timer.Start();

            timer.Tick += delegate
            {
                string s = "";
                switch (Control.MouseButtons)
                {
                    case MouseButtons.Left: s = "Left"; break;
                    case MouseButtons.Middle: s = "Middle"; break;
                    case MouseButtons.Right: s = "Right"; break;
                }
                this.Text = s;
            };
        }
    }

------解决方案--------------------
if (MouseButtons == MouseButtons.Left)
MessageBox.Show("mouse left click ");