DataGridView FirstDisplayedScrollingRowIndex属性如何改变?
我想让DataGridView 中的数据自动滚动
目前是想在计时器的事件中,改变FirstDisplayedScrollingRowIndex 的值.
下面是该计时器事件的代码:
private void timer1_Tick(object sender, EventArgs e)
{
//dgvcasebystreet为一个DataGridView 控件
int index = this.dgvcasebystreet.FirstDisplayedScrollingRowIndex;
index++;
this.dgvcasebystreet.FirstDisplayedScrollingRowIndex = index;
if (this.dgvcasebystreet.FirstDisplayedScrollingRowIndex > this.dgvcasebystreet.RowCount-1)
{
this.dgvcasebystreet.FirstDisplayedScrollingRowIndex = 0;
}
}
但是在调试时发现该FirstDisplayedScrollingRowIndex的值一直没有变化,且一直为0.
请问是不是要设置DataGridView 的什么属性,才能改变FirstDisplayedScrollingRowIndex的值?