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 / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Knowing which part of a Window is currently visible on the display

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ganesh - 12 Mar 2008 15:50 GMT
Dear Experts,
   I have an application that has several graphical components on it.
The state of these components is decided by some data which is
available in some data store. The graphical components periodically go
to the data base to see if the data has changed and accordingly change
their display state. Now its wasteful for my application to update its
graphical state if a particular component is not being visible
(meaning that some other Window is hiding a part or full of my
applications Window). I am trying to figure out which part of my
applications Window is currently visible on my computers display. This
way, my components can decided if they have to update themselves or
not (they could sit idle if they are not visible or could periodically
update their state if they are visible).
    Any idea on how I can check which region on my Window is
currently visible on the display? Thanks.

Regards,
Ganesh Okade
Sunlux Technologies Ltd.
Peter Duniho - 12 Mar 2008 19:27 GMT
> [...]
>      Any idea on how I can check which region on my Window is
> currently visible on the display? Thanks.

Well, you can find out when your control/form is actually drawn by  
checking the ClipRectangle in the PaintEventArgs.  You could also just  
compare the screen location with the screen boundary.

But IMHO this is not something you want to do.  While I understand the  
concern of not being "wasteful", in practice these sorts of optimizations  
can lead to poor performance when the optimization can't be used (e.g. the  
whole window is on-screen).  I've been down that road, as well as know of  
others who have, and it usually doesn't work out.

If there's a problem with performance when part of the window is  
off-screen, then there's a problem with performance when none of the  
window is off-screen.  Your effort will be better invested addressing  
performance in a more general way so that performance is acceptable  
regardless of where the window is.

Pete

Rate this thread:







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.