)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to improve scrolling speed in WinForms ScrollersFrame?

Platform: WinForms |
Control: ScrollersFrame |
Published Date: May 20, 2015 |
Last Revised Date: January 10, 2020

Improve the scrolling performance

When large number of controls are added to the Gradient Panel whose size is smaller than the added controls, and when you scroll for the invisible controls, then time delay may occur to paint the newly visible controls. This can be resolved by overriding the function OnScroll of the UserControl.

The following code example demonstrates the same.

C#

//Overriding OnScroll method of the UserControl
protected override void OnScroll(ScrollEventArgs se)
{
    if (se.ScrollOrientation == ScrollOrientation.VerticalScroll)
    {
        this.VerticalScroll.Value = se.NewValue;
    }
    else if (se.ScrollOrientation == ScrollOrientation.HorizontalScroll)
    {
        this.HorizontalScroll.Value = se.NewValue;
    }
    this.Invalidate();
    base.OnScroll(se);
}

VB

'Overriding OnScroll method of the UserControl
Protected Overrides Sub OnScroll(ByVal se As ScrollEventArgs)
    If se.ScrollOrientation = ScrollOrientation.VerticalScroll Then
        Me.VerticalScroll.Value = se.NewValue
    ElseIf se.ScrollOrientation = ScrollOrientation.HorizontalScroll Then
        Me.HorizontalScroll.Value = se.NewValue
    End If
    Me.Invalidate()
    MyBase.OnScroll(se)
End Sub

Samples:

C#: http://www.syncfusion.com/downloads/support/directtrac/135929/ScrollersFrame_OnScroll-555157854.zip

VB: http://www.syncfusion.com/downloads/support/directtrac/135701/ScrollersFrame_OnScroll_VB90170541.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon