2015.1.31 DataGridView自动滚动到某行

方法一、dv.CurrentCell = dv.Rows[i].Cells[2] 但此cell不能是隐藏cell

方法二、

if (dgr.Index < dv_sel_aw.FirstDisplayedScrollingRowIndex || dgr.Index > dv_sel_aw.FirstDisplayedScrollingRowIndex+dv_sel_aw.DisplayedRowCount(true))

dv_sel_aw.FirstDisplayedScrollingRowIndex = dgr.Index;

其中FirstDisplayedScrollingRowIndex当前显示界面的最顶端行index

dv_sel_aw.DisplayedRowCount(true)当前界面显示的行数 true表示包括部分行

posted on 2016-10-15 17:17  mol1995  阅读(1499)  评论(0编辑  收藏  举报

导航