// 恢复 DpTable 的状态 // 目前是栏宽度 static void SetDpTableState(DpTable table, string strText) { string strState = ""; if (IsType(strText, table, out strState) == false) return; DpTable.SetColumnHeaderWidth(table, strState, true); }
// 恢复 DpTable 的状态 // 目前是栏宽度 static void SetDpTableState(DpTable table, string strText) { string strState = ""; if (IsType(strText, table, out strState) == false) { return; } DpTable.SetColumnHeaderWidth(table, strState, true); }
// 从tablelayoutpanel中移除本Item2涉及的控件 // parameters: // nRow 从0开始计数 internal void RemoveFromTable(DpTable table, int nRow) { this.Container.DisableUpdate(); try { table.Rows.RemoveAt(nRow); #if NO // 移除本行相关的控件 table.Controls.Remove(this.label_color); table.Controls.Remove(this.textBox_catalogNo); table.Controls.Remove(this.comboBox_seller); table.Controls.Remove(this.comboBox_source); table.Controls.Remove(this.dateRange_range); table.Controls.Remove(this.comboBox_issueCount); table.Controls.Remove(this.comboBox_copy); table.Controls.Remove(this.textBox_price); table.Controls.Remove(this.location); table.Controls.Remove(this.comboBox_class); table.Controls.Remove(this.label_sellerAddress); table.Controls.Remove(this.label_other); Debug.Assert(this.Container.Items.Count == table.RowCount - 2, ""); // 然后压缩后方的 for (int i = (table.RowCount - 2) - 1; i >= nRow + 1; i--) { Item2 line = this.Container.Items[i]; // color Label label = line.label_color; table.Controls.Remove(label); table.Controls.Add(label, 0, i - 1 + 1); // catalog no TextBox catalogNo = line.textBox_catalogNo; table.Controls.Remove(catalogNo); table.Controls.Add(catalogNo, 1, i - 1 + 1); // seller ComboBox seller = line.comboBox_seller; table.Controls.Remove(seller); table.Controls.Add(seller, 2, i - 1 + 1); // source DoubleComboBox source = line.comboBox_source; table.Controls.Remove(source); table.Controls.Add(source, 3, i - 1 + 1); // time range DateRangeControl range = line.dateRange_range; table.Controls.Remove(range); table.Controls.Add(range, 4, i - 1 + 1); // issue count ComboBox issueCount = line.comboBox_issueCount; table.Controls.Remove(issueCount); table.Controls.Add(issueCount, 5, i - 1 + 1); // copy DoubleComboBox copy = line.comboBox_copy; table.Controls.Remove(copy); table.Controls.Add(copy, 6, i - 1 + 1); // price DoubleTextBox price = line.textBox_price; table.Controls.Remove(price); table.Controls.Add(price, 7, i - 1 + 1); // location LocationEditControl location = line.location; table.Controls.Remove(location); table.Controls.Add(location, 8, i - 1 + 1); // class ComboBox orderClass = line.comboBox_class; table.Controls.Remove(orderClass); table.Controls.Add(orderClass, 9, i - 1 + 1); // seller address Label sellerAddress = line.label_sellerAddress; table.Controls.Remove(sellerAddress); table.Controls.Add(sellerAddress, 10, i - 1 + 1); // other Label other = line.label_other; table.Controls.Remove(other); table.Controls.Add(other, 11, i - 1 + 1); } table.RowCount--; table.RowStyles.RemoveAt(nRow); #endif } finally { this.Container.EnableUpdate(); } }
// 将控件加入到tablelayoutpanel中 internal void AddToTable(DpTable table, int nInsertPos) { DpRow row = new DpRow(); DpCell cell = new DpCell(); cell.InnerControl = this.label_color; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.textBox_catalogNo; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.comboBox_seller; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.comboBox_source; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.dateRange_range; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.comboBox_issueCount; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.comboBox_copy; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.textBox_price; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.location; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.comboBox_class; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.label_sellerAddress; row.Add(cell); cell = new DpCell(); cell.InnerControl = this.label_other; row.Add(cell); if (nInsertPos >= table.Rows.Count) table.Rows.Add(row); else table.Rows.Insert(nInsertPos, row); AddEvents(); }
static string GetDpTableState(DpTable table) { return(table.GetType().ToString() + ":" + DpTable.GetColumnWidthListString(table)); }
static string GetDpTableState(DpTable table) { return table.GetType().ToString() + ":" + DpTable.GetColumnWidthListString(table); }