This chapter introduces some superficial ways to use the Timer control. describes common properties and events for a timer control
1. The Interval property represents the time interval for the timer control.
The type is int by default is milliseconds.
2. The enabled property indicates whether the timer control is active.
If activated, a tick event that enters the timer starts executing. So the default is False
3. Start () method
Start execution
4. Stop () method
Stop execution
5. Tick events
Represents the code that the Timer control will execute.
General use mode
1. Add a Timer control
2. after setting the necessary properties. Write the Timer_tick event directly. It would be nice to write a stop condition in the event.
invoking a timer using a lambda expression
Timer timer = new timer ();
Timer. Interval = 100;
Using lambda expressions
Timer. Tick + = (sender,e) =
{
if (Blah)
{
timer. Stop ();
}
};
Timer. Start ();
. NET Timer Control timer