Hi all!

I am running VS2005/,NET 2.0, and experience really slow performance on
the refresh rate of GUI when scrolling my forms.

To debug, I just created a clean UserControl and added about 50 empty
textboxes to it, no databinding, and set the AutoScroll property to
true.

When scrolling, the screen is updated really slow, the textboxes are
drawn partially, and blurr. CPU usage is 95-100%.

Does anybode know why this happens?

Best regards
Anders

Re: Slow redraw of controls when scrolling by Philipp

Philipp
Wed Jan 17 15:23:18 CST 2007

hello silver,

I guess during scroll all controls are repainted, this may also result
in a slight flicker. I had this problem myself with some controls I
designed. Try to put the following line in the user control constructor
(myControl.Designer.vb or .cs)

Me.DoubleBuffered = True (or this.DoubleBuffered = true; if you are
using c#)

and tell us if it solves the problem.

This setting forces all control drawing to take place in a second
buffer before it is sent to the screen.

Regards
Philipp Fabrizio


silver schrieb:

> Hi all!
>
> I am running VS2005/,NET 2.0, and experience really slow performance on
> the refresh rate of GUI when scrolling my forms.
>
> To debug, I just created a clean UserControl and added about 50 empty
> textboxes to it, no databinding, and set the AutoScroll property to
> true.
>
> When scrolling, the screen is updated really slow, the textboxes are
> drawn partially, and blurr. CPU usage is 95-100%.
>
> Does anybode know why this happens?
>
> Best regards
> Anders


Re: Slow redraw of controls when scrolling by silver

silver
Thu Jan 18 03:46:20 CST 2007

Thanks for your reply!

> hello silver,
>
> I guess during scroll all controls are repainted, this may also result
> in a slight flicker. I had this problem myself with some controls I
> designed. Try to put the following line in the user control constructor
> (myControl.Designer.vb or .cs)
>
> Me.DoubleBuffered = True (or this.DoubleBuffered = true; if you are
> using c#)
>
> and tell us if it solves the problem.
>
> This setting forces all control drawing to take place in a second
> buffer before it is sent to the screen.
>
> Regards
> Philipp Fabrizio
>
>

I have made some progress on this. A *release* build with DoubleBuffer
= True creates very good performance for the scroll of a UserControl.

The original issue is that we have the uc on a TabControl -> TabPage
surface. If I simply add the uc to the TabPage (drag 'n 'drop from the
Toolbox) the scroll gets extremely slow again. Note that the scrollbars
are defined on the uc, and the scroll is handled by it, as before, but
still performance stinks.

It seems like the TabPage hierarchy does not involve the UserControl
Type, and thus does not have the DoubleBuffer property.

Any advice is appreciated on how to boost the TabControl/TabPage
controls.

Anders


Re: Slow redraw of controls when scrolling by Philipp

Philipp
Sun Jan 21 05:05:07 CST 2007

ok, now that changes the problem a little bit. the cause for the major
performace lag is the gradient background of the tab control combined
with the transparency of all controls inside it.

to maintain the gradient for all controls, the tab page background is
calculated and repainted in a clip region for each control individually
before the control renders itself.

the only way to solve the problem is to set the background color of the
usercontrol or the tab page to a simple color like "Control", even if
it doesn't look that nice.

regards
philipp fabrizio

silver schrieb:

> Thanks for your reply!
>
> > hello silver,
> >
> > I guess during scroll all controls are repainted, this may also result
> > in a slight flicker. I had this problem myself with some controls I
> > designed. Try to put the following line in the user control constructor
> > (myControl.Designer.vb or .cs)
> >
> > Me.DoubleBuffered = True (or this.DoubleBuffered = true; if you are
> > using c#)
> >
> > and tell us if it solves the problem.
> >
> > This setting forces all control drawing to take place in a second
> > buffer before it is sent to the screen.
> >
> > Regards
> > Philipp Fabrizio
> >
> >
>
> I have made some progress on this. A *release* build with DoubleBuffer
> = True creates very good performance for the scroll of a UserControl.
>
> The original issue is that we have the uc on a TabControl -> TabPage
> surface. If I simply add the uc to the TabPage (drag 'n 'drop from the
> Toolbox) the scroll gets extremely slow again. Note that the scrollbars
> are defined on the uc, and the scroll is handled by it, as before, but
> still performance stinks.
>
> It seems like the TabPage hierarchy does not involve the UserControl
> Type, and thus does not have the DoubleBuffer property.
>
> Any advice is appreciated on how to boost the TabControl/TabPage
> controls.
>
> Anders