我现在要做的是鼠标按右键是否一直按下,移过一排按钮取值。 鼠标按下是在窗体上按下的。 不是控件。(C#)

解决方案 »

  1.   

    C#.Net反射机制?Win32API 窗体句柄?控件集合?没做过~
      

  2.   

    代码如下namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void Form1_MouseDown(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left)
                    this.MouseMove += new MouseEventHandler(Control_MouseMove);
            }        void Control_MouseMove(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left )
                {
                    Control c = ((Form)sender).GetChildAtPoint(e.Location);
                    if ((Button)c==button1)
                        textBox1.Text = "123";
                }
            }
        }
    }