设置数据网格视图的滚动条位置

本文关键字:滚动条 位置 视图 置数据 网格 | 更新日期: 2023-09-27 18:36:21

所以我在WinForms解决方案中有一个普通的DataGridView。

当您按 Tab 键浏览 DataGrid 中的单元格时,最终会到达所选单元格仅占视图一半的点。为了查看它,您必须滚动过去。

好吧,这显然是我想自动处理的事情,所以问题是......

如何使我的 DataGridView 在用户选项卡时自动滚动。

我搜索了滚动条索引值或位置值,但似乎找不到任何东西。

数据网格http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx

设置数据网格视图的滚动条位置

我认为您正在寻找类似FirstDisplayedCell的东西来控制您的滚动。

dataGridView1.FirstDisplayedCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.firstdisplayedscrollingrowindex.aspx