private void LoadProcessGroup() { // 加载工艺列表 processGroup = new hyProcessGroup(); processGroup.LoadProcessList(); // ComboBox 的显示 DataTable dt = new DataTable(); dt.Columns.Add("process_name"); dt.Columns.Add("process_id"); foreach (hyProcess process in processGroup.processList) { DataRow row = dt.NewRow(); row["process_name"] = process.process_name; row["process_id"] = process.process_id.ToString(); dt.Rows.Add(row); } comboBoxProcessName.DataSource = dt; comboBoxProcessName.DisplayMember = "process_name"; // 显示名 comboBoxProcessName.ValueMember = "process_id"; // 值 for (int i = 1; i < 31; i++) { comboBoxCarrierName.Items.Add(i.ToString()); } comboBoxCarrierName.SelectedIndex = 0; }
private void RowMergeViewInit() { dt = new DataTable(); // 添加第二级表头 dt.Columns.Add("工艺号"); for (int i = 0; i < dataGridViewTitle.Length; i++) { dt.Columns.Add((i * 2).ToString()); dt.Columns.Add((i * 2 + 1).ToString()); } this.processGroup = MainForm.processGroup; // 添加行 //dt.Rows.Add(new string[] { "工艺号"+i.ToString(),i.ToString("D4"), j.ToString("D4"), m.ToString("D4"), "1", "1", "1", "1", "1", "1", "1", "1", "1" }); foreach (hyProcess process in processGroup.processList) { string[] strArr = new string[27]; // 1 + 13*2 = 27 strArr[0] = process.process_name; //process.process_id.ToString(); for (int i = 0; i < hyProcess.stationNum; i++) { strArr[i * 2 + 1] = process.stationParaList[i].workingTemp.ToString(); // 工作温度 strArr[i * 2 + 2] = process.stationParaList[i].workingTime.ToString(); // 工作时间 } dt.Rows.Add(strArr); } this.rowMergeView1.DataSource = dt; this.rowMergeView1.ColumnHeadersHeight = 80; this.rowMergeView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //this.rowMergeView1.MergeColumnNames.Add("Column1"); rowMergeView1.Columns[0].Width = 150; // 添加第一级表头 for (int i = 0; i < dataGridViewTitle.Length; i++) { this.rowMergeView1.AddSpanHeader(i * 2 + 1, 2, dataGridViewTitle[i]); } // 高度 this.rowMergeView1.Height = this.rowMergeView1.ColumnHeadersHeight + this.rowMergeView1.RowTemplate.Height * 12; }