How to determine the visibility of a control?

How to determine if a control is visible to a user? I have a control that displays the status of the application, and I want it to be updated (its value should be updated, for example, increase the value of the progress bar or change the property of the label text) only if the user sees it. You do not need to update it if the user minimized the form containing this control, or if another form overlaps this control. I just don’t want to do extra calculations if the control is not visible. Also, how to identify events that hide / show this control?

+5
source share
5 answers

This, apparently, is one of the topics that is often asked and which has many possible solutions depending on the context.

First, for reference, I came across some links to old discussions during my research:

: IDE , . - hw . > 20 , 1 100 .

, " " .

() : , . , , .. , . , TabPage , ,... , .

+1

, , , , . , , , , , , . , - .

. - . , , . , , , . , , . Word , , . , . .

", ".

0

. Windows Paint, . , Paint Invalidate(), .

0

? , , . , 5 . / , . , . , , , .

:

I think you can achieve a performance improvement by identifying a model to detect / notify status changes instead of calculating on demand. You may need to weigh the rate of change of state with the rate of change of visibility in your control.

0
source
-1
source

All Articles