drawing issue

A

Alain R.

Hi,

i still did not understand how draw/ paint event work in some case.
for example, i have a control which has a content.
its content can be scrolled, therefore the content should be repaint/redraw.
i understood that there is a comparison with region shown before and new
region after scroll, but how can we know what should be redrawn ? which
part of content concretly ? :-(

is there a tutorial or some document that i can read and help me to make
my mind finally understand it ? :)

thanks a lot,

A.
 
M

Michael Nemtsev, MVP

Hello Alain R.,

Windows control all this redrawing stuff

Start from this MSDN article http://msdn2.microsoft.com/en-us/library/ms534902.aspx

and look for first Charlz Petzold books about Windows Programming, where
he examined in details all that drawing staff InvalidateRect, WM_PAINT and
other WinAPI methods

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> Hi,
A>
A> i still did not understand how draw/ paint event work in some case.
A> for example, i have a control which has a content.
A> its content can be scrolled, therefore the content should be
A> repaint/redraw.
A> i understood that there is a comparison with region shown before and
A> new
A> region after scroll, but how can we know what should be redrawn ?
A> which
A> part of content concretly ? :-(
A> is there a tutorial or some document that i can read and help me to
A> make my mind finally understand it ? :)
A>
A> thanks a lot,
A>
A> A.
A>
 
M

Michael Nemtsev, MVP

Hello Alain R.,

what exactly do u want to get?

Does the IsInternetConnected method meet all your requests?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> Hi,
A>
A> i still did not understand how draw/ paint event work in some case.
A> for example, i have a control which has a content.
A> its content can be scrolled, therefore the content should be
A> repaint/redraw.
A> i understood that there is a comparison with region shown before and
A> new
A> region after scroll, but how can we know what should be redrawn ?
A> which
A> part of content concretly ? :-(
A> is there a tutorial or some document that i can read and help me to
A> make my mind finally understand it ? :)
A>
A> thanks a lot,
A>
A> A.
A>
 
P

Peter Duniho

Alain said:
Hi,

i still did not understand how draw/ paint event work in some case.
for example, i have a control which has a content.
its content can be scrolled, therefore the content should be
repaint/redraw.
i understood that there is a comparison with region shown before and new
region after scroll, but how can we know what should be redrawn ? which
part of content concretly ? :-(

I'm not sure that you can in .NET. I'd love to be wrong, and hopefully
if I am someone will correct me.

In unmanaged code, you'd use ScrollDC or ScrollWindowEx to directly
scroll bits on the screen, optionally invalidating an area of the screen
to be redrawn and allowing you to even query this invalidated area if
you want to use it to restrict your own drawing code. But I'm not aware
of any similar functionality in the Graphics or Control classes (which
would be the usual .NET equivalents).

I think it's possible that the ScrollableControl component may use these
methods as the underlying functionality. If so, then one hopes you
could get some if not all of the performance advantage of doing it that
way by deriving your own scrolling control on the ScrollableControl
component (note that there are the PaintEventArgs.ClipRectangle property
and the Graphics.Clip property that you can use to control your own
drawing, assuming the invalidate region is set correctly by the
ScrollableControl). Otherwise, I suspect that you can only do it by
using p/invoke to use the unmanaged functions I mentioned above.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top