First button click to start timer, second to stop

前端 未结 5 676
独厮守ぢ
独厮守ぢ 2021-01-28 05:04

I\'m struggling with making button first click to start a timer, second click to stop the timer and etc.

Can anybody help me? :)

private void button7_Cli         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-28 05:29

    you can use this !!!!

    private void button8_click(object sender, EventArgs e)
    {
       if (timer1.Enabled) {
           timer1.Stop();
       } else {
         timer1.Start();
       }
    }
    

提交回复
热议问题