Scrolling smears controls

In my MDI app, when the user shrinks an MDI child form so scroll bars appear, then the uesr then drags the vertical scroll bar down, the contents of the form seem to get partially redrawn so they appear to stretch or smear at the bottom edge of the form. When the user stops the drag of the scrollbar, then the form draws itself and it looks fine.

What would cause the controls to not get re-drawn correctly on a scroll event? I would expect the contents of the form to move smoothly on a scrollbar drag as if it is larger than the container. But instead it looks like the form/contols are being partially drawn as the scrollbar is being dragged.

I was thinking I could register to listen to the scroll event, but I do not see any delegates for this when I am using the AutoScroll property of the form.

Any thoughts on how to make the scrolling look smooth?

thanks
Bryan

[882 byte] By [codefund.com] at [2007-12-16]
# 1
I think this happens because the redraw of the control occurs during idle time, and while scrolling quickly there isn't any. The scrolling actually does a bitblt to move as much of the window as is visible in both the before and after position. Then, the newly visible portion of the window is invalidated. Invalidate doesn't redraw immediately, but rather is cached until there is idle time to redraw the screen. If you want to force the draw, call the Update method on your Control or Form.

Unfortunately there isn't any scrolling event; you may have to override WndProc for the parent control and handle WM_VSCROLL and WM_HSCROLL to call Update.

Hope that helps!

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
Just wondering, but do you have smooth scrolling enabled through windows?
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
I cannot find a setting for the smooth scrolling. Can you direct me to where I can find this setting? I am running Windows 2000.

thanks
Bryan

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
Yes, overriding WndProc did fix the problem.

thanks
Bryan

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...