private void button1_Click(object sender, EventArgs e)
{
expendTime.start();
for (int q = 0; q < 100000; q++)
{
textBox1.Text = q.ToString();
Application.DoEvents();
}
label1.Text = expendTime.ComputerTime();
}
private void button2_Click(object sender, EventArgs e)
{
expendTime.start();
for (int q = 0; q < 100000; q++)
{
textBox2.Text = q.ToString();
}
label2.Text = expendTime.ComputerTime();
}
expendTime是私人自己实现的一个计时器把,就类似于Stopwatch。
这样啊,我还以为是某个空间里的方法呢,谢谢