Scrolling!

R

Rob Pollard

Hi All,
I am using the flow control (can't remember its full name), to display a
few dynamically created controls based on the tags the user has added to my
system. This works fine, except when a user scrolls this control area (when
there are a lot of controls) the screen update is terrible whilst the user
is actually scrolling. The result looks fine when they stop scrolling
though.

The nature of the problem is that it appears to me that when a user scrolls
only one line of pixels is being continuously written per newly shown line,
resulting in a kind of vertical blinds effect until the scrolling stops. Is
there a way to prevent this? Or will I have to override the scroll event and
provide my own functionality?

Thanks
RobP
'There are only 10 types of people in this world - Those that understand
binary and those that don't'
 
D

Dave Sexton

Hi Rob,

I don't think there is much you can do except to try double-buffering the Form or container control:

// .NET 2.0
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true)

(Note: SetStyle is a protected method on Control, which Form inherits)

Or, you can perform the rendering yourself and not use Controls. Many Controls being rendered simultaneously, especially during a
scroll operation, can be an expensive process. By reducing the number of Controls you're almost always going to increase
performance, and hopefully acheive smoother scrolling.
 
R

Rob Pollard

Thanks Dave,
I will try using the SetStyle method and see how I get on. The quote is
one I came across a while ago and tickled me when I first saw it!
 

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