public void updateProjectCT(DataGridView dgv, RandomTemp temp, int ranIndex) { int index = dgv.Rows.Add(); dgv.Rows[index].Cells[0].Value = ranIndex + 1; dgv.Rows[index].Cells[1].Value = temp.ColumnTwo.ToString(); temp.Rowindex1 = index; }
private void updateCTDGV(DataGridView dgv, List <RandomTemp> rt, int count) { dgv.Rows.Clear(); int x = 0; for (int i = 0; i < count; i++) { RandomTemp randomtemp = rt[i]; updateProjectCT(dgv, randomtemp, i); x++; } }
private void initData(List <RandomTemp> randomSaves) { int row = ColumnOneMax - ColumnOneMin + 1; int column = ColumnTwoMax - ColumnTwoMin + 2; int[,] statisticsArr = new int[row, column]; //初始化 for (int i = 0; i < row; i++) { statisticsArr[i, 0] = i + 1; for (int j = 1; j < column; j++) { statisticsArr[i, j] = 0; } } //统计 for (int i = 0; i < randomSaves.Count; i++) { RandomTemp randomtemp = randomSaves[i]; string[] strarr = randomtemp.ColumnTwo.Split(','); for (int j = 0; j < ColumnTwoCount; j++) { int r = int.Parse(randomtemp.ColumnOne.ToString()); int c = int.Parse(strarr[j]); statisticsArr[r - 1, c]++; } } //显示 填充 for (int i = 0; i < row; i++) { int index = dgv_Statistics.Rows.Add(); dgv_Statistics.Rows[index].Cells[0].Value = statisticsArr[i, 0]; for (int j = 1; j < column; j++) { dgv_Statistics.Rows[index].Cells[j].Value = statisticsArr[i, j]; } } }
public AddProgrammeForm(int ColumnOneRows, int ColumnTwoRows, int ProjectNo, int AdditionalColumnCount, int ColumnTwoMin, int ColumnTwoMax) { this.ColumnTwoRows = ColumnTwoRows; this.ColumnOneRows = ColumnOneRows; this.AdditionalColumnCount = AdditionalColumnCount; this.ColumnTwoMin = ColumnTwoMin; this.ColumnTwoMax = ColumnTwoMax; randomTemps = new List <RandomTemp>(); InitializeComponent(); for (int i = 0; i < ColumnOneRows; i++) { RandomTemp randomtemp = new RandomTemp(); randomtemp.ColumnOne = ""; randomtemp.ColumnTwo = ""; randomtemp.SingleCount1 = 0; randomtemp.Rowindex1 = -1; randomtemp.ProjectNo = ProjectNo; randomtemp.ProjectCount = 0; randomtemp.ProjectMemo = "0次"; randomTemps.Add(randomtemp); } initDGV(); }