WinForm, the function is called once every time (parameter) (using the timer)

Source: Internet
Author: User

1System.Windows.Forms.Timer SetTimer;//Define a timer2         intFLG =0;//define a vertical flag3         Private voidBtnsettime_click (Objectsender, EventArgs e)4         {5SetTimer =NewSystem.Windows.Forms.Timer ();6             inti = Convert.ToInt32 (Nudsettime.value);//the value of the interface control, initialized 5 minutes after refresh, can be customized7             Switch(i)8             {9                  Case 5:TenSettimer.interval = the;//executes automatically every 5 seconds One                      Break; A                  Case Ten: -Settimer.interval =10000;//executes automatically every 10 seconds -                      Break; the                  Case  the: -Settimer.interval =900000;//Auto-Execute every 15 minutes -                      Break; -             } +Settimer.tick + =Timer1_Tick; -Settimer.start ();//Turn on Timer +FLG =1; A         } at         //Load Map -         Private voidTimer1_Tick (Objectsender, EventArgs e) -         { - gmapload (); -         } -         //When the interval value changes, the timer shuts down in         Private voidNudsettime_valuechanged (Objectsender, EventArgs e) -         { to             if(FLG = =1) +             { -Settimer.stop ();//Turn off the timer theFLG =0; *             } $}

WinForm, the function is called once every time (parameter) (using the timer)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.