Articles in this section
Category / Section

How to resolve scrolling position issue in WinForms GridDataBoundGrid?

2 mins read

Scrollbar thumbtrack position

By default, the scrollbar’s ThumbTrack position is set based on the column position and row position. But the ThumbTrack is not set to correct position when grid’s RowHeaders and ColumnHeaders are disabled with the RowHeaders and ColumnHeaders property. The following screenshot illustrates the exact issue.

Show the scrollbar in horizontal and vertical with unwanted space

 

Solution

The vertical scrollbar’s and horizontal scrollbar’s ThumbTrack can be tracked to correct scroll position by enabling the UseOldHiddenScrollLogic static property of the GridControlBase. This property is set before the InitializeComponent() or grid initializing code.

C#

//The following property is enabled above the grid initialization code or InitializeComponent()
GridControlBase.UseOldHiddenScrollLogic = true;
InitializeComponent();

VB

'The following property is enabled above the grid initialization code or InitializeComponent()
GridControlBase.UseOldHiddenScrollLogic = true
InitializeComponent

 

Note:

This is applicable for the GridDataBoundGrid control also.

Screenshot

Show the scrollbar in horizontal and vertical without unwanted space

Samples:

C#: ScrollBar_ThumTrack_Position_CS

VB: ScrollBar_ThumTrack_Position_VB


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