private void DataSheetLoad(int page) { ResultDataSheet.Rows.Clear(); ResultDataSheet.Hide(); int start = (nPage - 1) * 10; int end = nPage * 10; if (nPage == maxPage) { end = ClassBackEnd.Book.Count; } for (int i = start; i < end; i++) { var c = ClassBackEnd.Book[i]; DataGridViewRow row = (DataGridViewRow)ResultDataSheet.RowTemplate.Clone(); int index = ResultDataSheet.Rows.Add(row); ResultDataSheet.Rows[index].Cells[0].Value = c.Bookisbn; ResultDataSheet.Rows[index].Cells[1].Value = c.Bookname; ResultDataSheet.Rows[index].Cells[2].Value = c.Author; ResultDataSheet.Rows[index].Cells[3].Value = c.Publisher; ResultDataSheet.Rows[index].Cells[4].Value = "详情"; } LoadGIFBox.Hide(); ResultDataSheet.Show(); ResultDataSheet.ClearSelection(); ResultDataSheet.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
private void DataSheetLoad(int page) { ResultDataSheet.Rows.Clear(); ResultDataSheet.Hide(); if (ClassBackEnd.Book.Count == 0) { LoadGIFBox.Hide(); NoResultTextBox.Show(); AddBookButton.Show(); NextPbutton.Hide(); LastPButton.Hide(); JumpPTextBox.Hide(); PageTextBox.Hide(); DividePicture.Hide(); return; } else { NoResultTextBox.Hide(); AddBookButton.Hide(); NextPbutton.Show(); LastPButton.Show(); JumpPTextBox.Show(); PageTextBox.Show(); DividePicture.Show(); } int start = (nPage - 1) * 10; int end = nPage * 10; if (nPage == maxPage) { end = ClassBackEnd.Book.Count; } for (int i = start; i < end; i++) { var c = ClassBackEnd.Book[i]; DataGridViewRow row = (DataGridViewRow)ResultDataSheet.RowTemplate.Clone(); int index = ResultDataSheet.Rows.Add(row); ResultDataSheet.Rows[index].Cells[0].Value = c.Bookisbn; ResultDataSheet.Rows[index].Cells[1].Value = c.Bookname; ResultDataSheet.Rows[index].Cells[2].Value = c.Author; ResultDataSheet.Rows[index].Cells[3].Value = c.Publisher; ResultDataSheet.Rows[index].Cells[4].Value = "详情"; } LoadGIFBox.Hide(); ResultDataSheet.Show(); ResultDataSheet.ClearSelection(); ResultDataSheet.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; JumpPTextBox.Text = nPage.ToString(); PageTextBox.Text = maxPage.ToString(); }