Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2006

Tip: Looking for answers? Try searching our database.

How to test if a control is visible on screen

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Reiner Obrecht - 07 Aug 2006 17:47 GMT
Hallo experts

How can I test if a control is currently visible on screen and not hidden by
other windows?
Mini-Tools Timm - 09 Aug 2006 14:05 GMT
> How can I test if a control is currently visible on screen and not hidden by
> other windows?

I'm unaware of any easy API call to do this (perhaps there is a User32
function?).  In lieu of an easy solution, you could try a more brute-force
method:

1.  Get an array of all open windows.  (You can use the User32 EnumWindows
function and Interop to get this.)
2.  Iterate through the array.  Every window in the array before your window
is higher in the Z-order, i.e., can potentially cover the control in your
window.
3.  Find the screen coordinates of your control.  You can find the upper
left-corner with the control.PointToScreen( new Point(0,0) ) method.
4.  Ensure that none of the higher-Z-order windows cover the control's
screen coordinates.

Signature

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.