判断DataGridView滚动条是否滚动到当前已加载的数据行底部

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;
    }
  }

}

原文地址:https://www.cnblogs.com/marshhu/p/4689710.html