Re: Graphics 102 : regional refresh of form/control

Tech-Archive recommends: Speed Up your PC by fixing your registry



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" <poliphant@xxxxxxxxxxxxxxxx> wrote in message news:%23CEAWko2FHA.1292@xxxxxxxxxxxxxxxxxxxxxxx

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
.



Relevant Pages

  • Graphics 102 : regional refresh of form/control
    ... graphics when Paint was called. ... I then made it so it only called refresh once every so often. ... BUT - I'd like to be able to refresh only a portion (rectangular region) of ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Refresh() and Invalidate()
    ... Calling Refresh after an Invalidate call shouldn't cause your control to ... What I would expect to see is one Paint event (which means ... From MSDN's docs about Refresh: ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Refresh() and Invalidate()
    ... paint twice. ... So your control's entire client area would be invalidated, and since that would contain any region you passed to Invalidate, your Paint event would show the whole client area as invalid. ... Given what Refresh does, calling Invalidate and then immediately calling Refresh - regardless of whether you pass a region to Invalidate or not - is unnecessary; calling Refresh will get you there. ... Note that Refresh also causes a redraw of all child controls, which is an important distinction from Invalidate ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Refresh-Methode
    ... "Unterschiede zwischen Invalidate, Update und Refresh ... alternativ kannst Du im Konstruktor Deines Steuerelementes ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: some questions about layout
    ... Refresh calls Invalidate & Update ... > Pocket Loox 720 and i'm NOT using the Designer!! ... > 2 why is refreshand updateon a panel not working an i have to use ...
    (microsoft.public.dotnet.framework.compactframework)