private void SheetLoad() { int i = 0; for (i = 0; i < ClassBackEnd.Bookhis.Count; i++) { var tmp = ClassBackEnd.Bookhis.Count - i; DataGridViewRow row = new DataGridViewRow(); int index = CreditRecordSheet.Rows.Add(row); CreditRecordSheet.Rows[i].Cells[0].Value = tmp.ToString(); CreditRecordSheet.Rows[i].Cells[1].Value = ClassBackEnd.Bookhis[i].Time; CreditRecordSheet.Rows[i].Cells[2].Value = ClassBackEnd.Bookhis[i].Cat; CreditRecordSheet.Rows[i].Cells[3].Value = ClassBackEnd.Bookhis[i].Userid; CreditRecordSheet.Rows[index].Height = 48; } while (i < 11) { DataGridViewRow row = new DataGridViewRow(); int index = CreditRecordSheet.Rows.Add(row); CreditRecordSheet.Rows[i].Cells[0].Value = ""; CreditRecordSheet.Rows[i].Cells[1].Value = ""; CreditRecordSheet.Rows[i].Cells[2].Value = ""; CreditRecordSheet.Rows[i].Cells[3].Value = ""; CreditRecordSheet.Rows[index].Height = 48; i++; } CreditRecordSheet.ClearSelection(); CreditRecordSheet.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; CreditRecordSheet.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; CreditRecordSheet.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; CreditRecordSheet.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
private void SheetLoad() { int i = 0; for (i = 0; i < list.Count; i++) { DataGridViewRow row = new DataGridViewRow(); int index = CreditRecordSheet.Rows.Add(row); CreditRecordSheet.Rows[i].Cells[0].Value = (i + 1).ToString(); CreditRecordSheet.Rows[i].Cells[1].Value = list[i]; CreditRecordSheet.Rows[index].Height = 68; } while (i < 8) { DataGridViewRow row = new DataGridViewRow(); int index = CreditRecordSheet.Rows.Add(row); CreditRecordSheet.Rows[i].Cells[0].Value = ""; CreditRecordSheet.Rows[i].Cells[1].Value = ""; CreditRecordSheet.Rows[index].Height = 68; i++; } CreditRecordSheet.ClearSelection(); CreditRecordSheet.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }