How to check absolute control visibility and how to be notified for changes of absolute visibility
- by portakalla
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.
Is there a way to be notified for visibility changes without recursively listening parent visibility changes?
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.