NetBlog主题

C#,WinForm计时器,可以拓展循环执行某个方法
C#基础

C#,WinForm计时器,可以拓展循环执行某个方法

2711 0

bool isRunning = true;//用来改变计时状态Thread td;private void Form1_Load(object sender, EventArgs e){btnEnd.Enabled = false;}#region 计时void TimeTask(){try{double timeCal = 0;while (isRunning){Thread.Sleep(1000);//休眠1000毫秒timeCal++;this.label1.BeginI…