private void SetForGridViewPage() { //DataGridView分页 dgvPage = new ClsDataGridViewPage(); dgvPage.GetDataGridView = this.dataGridView1; //需要分页的是 dataGridView1 dgvPage.RowsPerPage = 15; //每页显示多少条记录 dgvPage.SetDataView = m_GridTable.DefaultView; dgvPage.Paging(); //调用分页类的Paging 方法开始分页 if (dgvPage.TotalPage > 0) { this.btnFirst.Enabled = true; this.btnLast.Enabled = true; this.btnPre.Enabled = true; this.btnNext.Enabled = true; this.tbxCurrPage.Enabled = true; this.tbxCurrPage.Text = (dgvPage.curPage + 1).ToString(); this.lblTotalPage.Text = dgvPage.TotalPage.ToString(); } else { this.btnFirst.Enabled = false; this.btnLast.Enabled = false; this.btnPre.Enabled = false; this.btnNext.Enabled = false; this.tbxCurrPage.Text = "0"; this.tbxCurrPage.Enabled = false; this.lblTotalPage.Text = "0"; } }