當前位置:編程學習大全網 - 電腦編程 - C#怎麽用Timer做壹個30秒倒計時小程序

C#怎麽用Timer做壹個30秒倒計時小程序

public partial class Form1 : Form

{

int count = 30;

public Form1()

{

InitializeComponent();

textBox1.Text = count.ToString();

timer1.Start();

}

private void timer1_Tick(object sender, EventArgs e)

{

if (--count == 0)

count = 30;

textBox1.Text = count.ToString();

}

}

  • 上一篇:如何實現在VBA窗體壹鍵切換
  • 下一篇:新手 編譯運行 HelloWorld 的問題
  • copyright 2024編程學習大全網