1

I'm using a custom scroll bar and the problem I'm facing now is that when I have thousands of rows in a datagrid and scroll all the way to the bottom, dataGrid.VerticalScrollingOffset is about + 400 higher thank customScrollbar.Value. Which ends up with dataGrid now showing last few records, because it hasn't scrolled down enough.

It would be perfect if I could set dataGrid.VerticalScrollingOffset value or get the maximum vertical scrolling value of dataGrid, I couldn't find any information on nether.

Currently I'm calculating the maximum value like rowCount*rowHeight, which doesn't give exact max value, therefore it's not scrolling down all the way. Any suggestions? Thanks!

0

1 Answer 1

3

You can use [FirstDisplayedScrollingRowIndex][1]:

// To Scroll down
this.FirstDisplayedScrollingRowIndex = this.FirstDisplayedScrollingRowIndex + 1;

If you want to have per pixel increment, place the DataGridView in a Panel whose AutoScroll property is set to true.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but I need a way to set pixel value, not row index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.