How can one detecting if the client region of a window is currently visible to the user ?

M

Matt Davey

What is the easiest way to detect if the client region of a window is
visible to the user, or to put it another way, how can U detect the
following

1. A window is minimized, and thus its client region is non-visible to the
user
2. A window is hidden from view e.g. in a tab control, the contents of only
one tab are visibile/active at a time
3. A window is hidden by another window - e.g. in an MDI, a window is moved
ontop of another window, hence hidding a window

Obviously for 2, U can catch the tab click, and hence know what tab you are
clicking to/from. But is there another more generic way

Thanks

Later
 
M

Morten Wennevik

1: Handle the SizeChanged or Resize events and check for
this.WindowState == FormWindowState.Minimized

2: Handle the Deactivated event

3: Not really your problem. You can detect if a certain window has focus(=
the active window) or not, but the user is responsible for partly or fully
or not at all covering other windows.

If you are thinking about how much of the client window to repaint, you
get told in the paint event in the ClipRectangle property of the
PaintEventArgs
 
M

Matt Davey

1 can also be done by overrideing the wndproc. I just remembered this as I
pressed the send

2. Thanks

Later


1: Handle the SizeChanged or Resize events and check for
this.WindowState == FormWindowState.Minimized

2: Handle the Deactivated event

3: Not really your problem. You can detect if a certain window has focus(=
the active window) or not, but the user is responsible for partly or fully
or not at all covering other windows.

If you are thinking about how much of the client window to repaint, you
get told in the paint event in the ClipRectangle property of the
PaintEventArgs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top