.NET Timer Controls Faster While the Window is Minimized

In fact, this is a noticeable difference that I saw, but can not explain. These timers have 1 ms intervals (the lowest available), but while it is minimized, does it seem to go out faster? Can someone explain this phenomenon to me? And if possible, explain how to reproduce the effect when the window is maximized?

+3
source share
2 answers

Is it Forms.Timer?

I doubt that it works faster, it is more likely that the timer response time is handled more timely. At the same time, apparently, fewer messages processed by the form window message pump will be minimized, which can take into account a large time slice for processing timer messages. There is also a minimum timer resolution.

If applicable, try using one of the other timer types, for example System.Timers

The Windows Forms Timer component is single-threaded, and accuracy is limited to 55 milliseconds. if you require a multi-threaded timer with higher precision, use the Timer class in the System.Timers namespace.

Link .

+3
source

, , System.Windows.Forms.Timer (, , ), 55 . 1 , .

, , . (, ), . 1 , , (55 ) .

, , .

+2

Source: https://habr.com/ru/post/1730645/


All Articles