By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Graphics 102 : regional refresh of form/control

P: n/a
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==]
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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==]

"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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==]

Nov 17 '05 #2

P: n/a
Peter Oliphant wrote:
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==]

"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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,

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

--
Rob Schieber
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.