日期:2014-05-20  浏览次数:20730 次

MessageBox.Show
C# code

    public partial class Form1 : Form
    {
        int i = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            timer1.Interval = 1000;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            i++;
            MessageBox.Show(i.ToString());
            if (i >= 5)
                timer1.Enabled = false;//timer停止
        }
    }


为什么它就停不掉?MessageBox.Show还有这功能?

------解决方案--------------------

你自己看看你的代码,真是服了你了!

------解决方案--------------------
探讨
C# code

private void timer1_Tick(object sender, EventArgs e)
{
i++;
MessageBox.Show(i.ToString()); //应该是i+1,然后打出来,然后再加1,然后再打,直到i=5,不是?
if (i >= 5) ……