就是按下按钮并保持之,连续不断地执行相同的操作,直到抬起后方停止。

解决方案 »

  1.   

    按钮的 mousedown 事件中 激活 timer 事件,mouseup事件中 取消 timer 事件,在timer事件中干你想干的事情。
      

  2.   

    用Enable来做把
    Enable = false
    /// doing
    Enable = true
    或者用两个图片 
      

  3.   

    定义个线程
    thread  thwhile(true)
    {
      th.start();
    }
      

  4.   


    // 模拟该按钮按下
    SendMessage(hWnd, BM_SETSTATE, BST_PUSHED, 0);// 停顿时间
    ::Sleep(100);// 模拟该按钮弹起
    SendMessage(hWnd, BM_SETSTATE, 0, 0);
      

  5.   

    按钮按下不抬起,根本不会执行 
    怪异的想法
    你应该不间断的执行同一段代码
    如4L的  while(true)
      

  6.   

    一个小例子:using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace pressButton
    {
        public partial class Form1 : Form
        {
            int i = 0;
            public Form1()
            {
                InitializeComponent();
            }        private void button1_MouseDown(object sender, MouseEventArgs e)
            {
                timer1.Enabled = true;
            }        private void button1_MouseUp(object sender, MouseEventArgs e)
            {
                timer1.Enabled = false;
                i = 0;
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                label1.Text = (++i).ToString();
            }
        }
    }
      

  7.   

    winform里有一种控件叫HScrollBar,是一个滑块两端各有一个按钮,按下左端的按钮滑块就会一直向左移动,直到你抬起鼠标释放按钮为止,同样你按下右边的按钮就会一直向右移动,直到你抬起鼠标释放按钮为止。我的意思就是说如何自己编程实现这种按钮的功能。至于具体实现什么功能不重要,关键是如何实现功能不断连续触发。不知您明白我的意思没有。
      

  8.   

    设置两种状态,
    while (CheckButton=true)
    {}
      

  9.   

    用CheckBox代替Button
    设置CheckBox的Appearance属性为Button
    当Checked变为true后开始执行你的任务,
    执行完成后,设置其Checked为false