Need to use Timer Timer control
Timer1. Interval Set time interval
Timer1. Trigger event when Tick arrives at time interval
Test_tick Time processing function
Timer1. Tick + = new System.EventHandler (Test_tick);
Delegate to handle events, you can generally add the above code to register the Test_tick handler function in the constructor of the form InitializeComponent the constructor interface component function;
Of course, you don't have to worry about it. Double-click the Timer control directly in the Form view, and the system will automatically help you generate a handler function similar to Test_tick
Typically, you need to use timer1. Start ()//Startup timer timer1. Stop ();. Turn off the Timer method
The general code process is as follows:
private void Form_Load (object sender, EventArgs e)
{timer1. Interval = 1000;
Timer1. Start ();}
private void Test_tick (...)
{
The function body that needs to be executed every second, and the function is executed every second after timer start
}