如何判断 dataGridView 滚动条是否到底
1个回答
展开全部
private void dataGridView1_Scroll(object sender, ScrollEventArgs e)
{
if (e.ScrollOrientation == ScrollOrientation.VerticalScroll &&
(e.NewValue + dataGridView1.DisplayedRowCount(false) == dataGridView1.Rows.Count))//垂直滚动条滚动到底部,数据为加载完,则再次加载
{
if (this.m_HasLoaderFinish == true) return;
if (this.m_Cursor != null)
{
//设置当前光标为忙碌状态
this.Cursor = Cursors.WaitCursor;
try
{
//填充记录集到数据
this.FillRecordToDataTable(this.m_Fields);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//设置当前光标为正常状态
this.Cursor = Cursors.Default;
}
}
}
{
if (e.ScrollOrientation == ScrollOrientation.VerticalScroll &&
(e.NewValue + dataGridView1.DisplayedRowCount(false) == dataGridView1.Rows.Count))//垂直滚动条滚动到底部,数据为加载完,则再次加载
{
if (this.m_HasLoaderFinish == true) return;
if (this.m_Cursor != null)
{
//设置当前光标为忙碌状态
this.Cursor = Cursors.WaitCursor;
try
{
//填充记录集到数据
this.FillRecordToDataTable(this.m_Fields);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//设置当前光标为正常状态
this.Cursor = Cursors.Default;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询