time C # learning controls and timer_tick events ----- reprint




Timer control: Timer Tick event bound controls only, and will set up automatic timing after Enabled = True, you can stop the clock with Stop () control, after passing through the Stop () to stop, if you want to re-timing, you can use Start () method to start the timer. Timer control it in the Form and belong to the same thread;
timer1_Tick: Timer object is an event of an event that triggered automatically after a set time interval. For example, we want to execute a piece of code functions time interval of 1 second. We can:

Private void the Form1_Load (SENDER Object, EventArgs E)
        {            
            Timer1.Interval = 1000; // milliseconds
        }

Private void the timer1_Tick (SENDER Object, EventArgs E)
        {
            // code automatically performed
        }
Timer1 timer object is example, is in the running, in an instance of its scope. If you define the form so long as the form does not have to be destroyed this timer1 in memory
----------------
Disclaimer: This article is CSDN blogger "Yong princes" of original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/ycigwy/article/details/70242669

Guess you like

Origin www.cnblogs.com/bedfly/p/12128429.html