How to check absolute control visibility and how to be notified for changes of absolute visibility

Posted by portakalla on Stack Overflow See other posts from Stack Overflow or by portakalla
Published on 2009-11-26T18:19:38Z Indexed on 2010/04/18 8:03 UTC
Read the original article Hit count: 493

Filed under:
|
|
|

I have several controls inside my form and I perform several changes (Text, Font, BackColor etc.) on these controls. My changes are necessary only if the controls are visible. So, I want to stop performing my changes on controls that are not visible. I want to keep changing my controls when they become visible again.

I can use Control.Visible and Control.VisibleChanged, however they are not satisfactory for my purpose.

The problem is, VisibleChanged is not fired when control becomes invisible due to its parent (i.e. because its parent became invisible). Interestingly, it is fired when control becomes visible again.

  1. Is there a way to be notified for visibility changes without recursively listening parent visibility changes?

  2. I also want to be notified when another form is placed over my form and some of my controls become non-visible. I call this absolute visibility. (Is there another term for it?) Is there an event that I can use for this purpose?

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms