How to check absolute control visibility and how to be notified for changes of absolute visibility
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 vi开发者_开发知识库sible. 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.
You could set up a timer that checks the state of the .Visible property on the control and fire an event when that changes.
精彩评论