Sign in to follow this  
Stru

[.net] Detecting visibility of a form

Recommended Posts

How can I detect whether or not the contents of a form are actually visible on the screen? I am not just talking about the Visible property. I would like to be able to tell if a form is covered by another window or dragged so that the contents are not visible onscreen.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stru
How can I detect whether or not the contents of a form are actually visible on the screen? I am not just talking about the Visible property. I would like to be able to tell if a form is covered by another window or dragged so that the contents are not visible onscreen.

Are you asking if any portion of it is covered, or all of it is covered?

Share this post


Link to post
Share on other sites
I only need to know whether or not the entire client area of the form is covered. I dont care whether or not the control box / title bar is visible, just whats in the form. I also don't care if only part of the form is visible, even if its only one pixel, but if no pixels in the client part of the form are visible then I would like to know.

Share this post


Link to post
Share on other sites
The win32 function, GetWindow, should be one way to do it. You could determine which windows are in front of your window, and then do simple rect calculations to see if the entirety of your client area is blocked by any of the windows higher in the z-order.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this