Threading.Timer vs. Forms.Timer

前端 未结 3 1800
忘掉有多难
忘掉有多难 2020-12-13 14:45

The short form of this question: When, if ever, is it appropriate to use the Forms.Timer in a multithreaded WinForms application?

More specifically, I am architectin

相关标签:
3条回答
  • 2020-12-13 15:27

    MSDN had a comparison article that does the subject justice.

    0 讨论(0)
  • 2020-12-13 15:29

    I agree with what Mehrdad and David said, but you should be aware that timers offer no guarantee of timeliness or order or execution. Too many timers and the application will just hang ;-)

    0 讨论(0)
  • 2020-12-13 15:34

    Forms.Timer registers the timer to send a message when the timer goes off. The event raised is treated like a GUI event. System.Threading.Timer uses a thread blocking approach. Basically, you should use Forms.Timer for your GUI oriented timers (to add some effects to the user interface) and Threading.Timer for scheduling tasks and other things.

    0 讨论(0)
提交回复
热议问题