日期:2014-05-19  浏览次数:20826 次

datagridview中如何移动行(改变行的显示位置)
datagridview中如何移动行(改变行的显示位置)
datagridview已经绑定数据 <binddatasource>   ----   <datatable>
<datatable> 为readonly


------解决方案--------------------
使用FirstDisplayedScrollingRowIndex就可以了,比如:

private void btnDownPage_Click(object sender, EventArgs e)
{
int downPage = this.dataGridView1.FirstDisplayedScrollingRowIndex + this.dataGridView1.DisplayedRowCount(false);
if (downPage < this.dataGridView1.Rows.Count - this.dataGridView1.DisplayedRowCount(false))
{
this.dataGridView1.FirstDisplayedScrollingRowIndex = downPage;
}
else
{
this.dataGridView1.FirstDisplayedScrollingRowIndex = this.dataGridView1.Rows.Count - this.dataGridView1.DisplayedRowCount(false);
}
}

------解决方案--------------------
datatable.DefaultView 里做文章?

我也在关注这个...