Hi AdiiS,
We need to create our own DataGridView and override the OnScroll method. In the method, we can set the new value equal to the old value to avoid rows/columns moving. This is the code snippet:
public class MyDataGridView : DataGridView
{
public MyDataGridView()
{
//Enable both scrollbars.
this.ScrollBars = ScrollBars.Both;
}
protected override void OnScroll(ScrollEventArgs e)
{
//Set the new value equal to old value to avoid moving.
e.NewValue = e.OldValue;
base.OnScroll(e);
}
}
Let me know if this helps.
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.