操作数据之后,往往需要刷新DataGridView, 可是滚动的位置会回到开头。

让操作的人很不舒服。

可以用下面的代码来解决

int iScrollIndex = grdList.FirstDisplayedScrollingRowIndex;

// 往grid里加数据...

if (iScrollIndex >= 0 && iScrollIndex < grdList.RowCount)
{
grdList.FirstDisplayedScrollingRowIndex = iScrollIndex;
}

 

相关文章:

  • 2022-01-29
  • 2022-03-06
  • 2021-06-21
  • 2021-10-18
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-18
  • 2021-12-10
  • 2021-08-02
  • 2022-01-08
  • 2022-02-25
相关资源
相似解决方案