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 / Managed C++ / October 2005

Tip: Looking for answers? Try searching our database.

Graphics 102 : regional refresh of form/control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Oliphant - 27 Oct 2005 00:57 GMT
I now have graphics being drawn in the Paint event of my form (yeah, and
it's very cool). Problem was that it only updated any changes to these
graphics when Paint was called.

So, I then made it so the Refresh() method of the form was called for each
graphic object. In this case it drew just fine, but Paint was being called
so often I lost control of the form (e.g., trying to close the form using
the close 'x' in upper right corner resulted in an hour-glass icon and no
action).  I then made it so it only called refresh once every so often. Now
all is good...

BUT - I'd like to be able to refresh only a portion (rectangular region) of
the form for speed. I notice all the .NET Control's can do this. I also
don't think the Control's Refresh() has an overloaded version that
establishes the rectangle of refresh.

Is there a 'region refresh' for controls (or possibly just for containers or
forms), and what is it if it does exist?

Thanks in advance!  : )

[==P==]
Peter Oliphant - 27 Oct 2005 01:07 GMT
Ok, I may have a partial answer to my own question. There is a Control
method called Invalidate() that let's me invalidate any rectangular region
of the Control. So this is what I was looking for.

BUT - does this mean that Refresh() only refreshes invalidated areas? Does
drawing a graphic (ala the Graphics class, for example the use of
DrawLine()) automatically invalidate the graphic object's region? If so, I
don't need to do anything more than what I'm already doing!   : )

[==P==]

>I now have graphics being drawn in the Paint event of my form (yeah, and
>it's very cool). Problem was that it only updated any changes to these
[quoted text clipped - 18 lines]
>
> [==P==]
Rob Schieber - 27 Oct 2005 20:46 GMT
> Ok, I may have a partial answer to my own question. There is a Control
> method called Invalidate() that let's me invalidate any rectangular region
[quoted text clipped - 29 lines]
>>
>>[==P==]

Peter,

InvalidateRect and Update seem to be the winning combo for me.  I'm not
sure what the offical answer is though.

Signature

Rob Schieber


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.