Articles in this section
Category / Section

How to use custom scroll bar for WinForms GridGroupingControl?

2 mins read

Customize the scrollbar

To add a custom scrollbar, you need to set the GridScrollBarMode as shared. In order to adjust the size of thumb you need to use MetroThumbSize of scrollersFrame.

C#

//Form Load
//to apply custom scrollbar
this.gridGroupingControl1.TableControl.HScrollBehavior = GridScrollbarMode.Shared;
this.scrollersFrame1.AttachedTo = this.gridGroupingControl1.TableControl;
this.scrollersFrame1.VisualStyle = ScrollBarCustomDrawStyles.Metro;
//to adjust the thumb size of scrollbar
this.scrollersFrame1.MetroThumbSize = new Size(5, this.scrollersFrame1.MetroThumbSize.Height);

 

VB

'to apply custom scrollbar
Me.gridGroupingControl1.TableControl.HScrollBehavior = GridScrollbarMode.Shared
Me.scrollersFrame1.AttachedTo = Me.gridGroupingControl1.TableControl
Me.scrollersFrame1.VisualStyle = ScrollBarCustomDrawStyles.Metro
'to adjust the thumb size of scrollbar
Me.scrollersFrame1.MetroThumbSize = New Size(5, Me.scrollersFrame1.MetroThumbSize.Height)

 

Screenshot:

Before customize the thumb size After customize the thumb size
     Before customizing the thumb size                           After customizing the thumb size.

Note:
  1. If you are using ScrollerFrame, then you need to use AttachedTo() and the maximum width of thumb is limited to the up to the size of scroller bounds.
  2. Instead of using ScrollerFrame, if you want to use any other scrollbars, you can refer this article.

 

Samples:

C#: CustomScrollBar

VB: CustomScrollBar

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied