/// <summary> /// 涉及到显示相关时调用【如可见性,可用性更改】 /// </summary> public void RefreshShow() { //清除所有列 this.Rows.Clear(); ParameterCollection collection = this.m_Parameters; if (collection == null) { return; } foreach (var parameterItem in collection) { int tempIndex = this.Rows.Add(); this.Rows[tempIndex].Height = m_RowHeight; object tempValue = parameterItem.Value; if (tempValue is bool) { SetEditor(this.Rows[tempIndex], parameterItem, new DataGridViewCheckBoxCell()); } else if (tempValue is Enum) { } else { var tempControl = parameterItem.ShowControl; if (tempControl != null && tempControl.IsDropDown) { TSZComboBoxCellExtend cellControl = new TSZComboBoxCellExtend(); cellControl.Numeric = tempControl.IsNumber; cellControl.Items.AddRange(tempControl.Items ?? new List <object>()); SetEditor(this.Rows[tempIndex], parameterItem, cellControl); } else { #region 没有设置按默认的显示 SetEditor(this.Rows[tempIndex], parameterItem, new DataGridViewTextBoxCell()); #endregion } } } }
private void UpdateUditor(DataGridViewRow row, ParameterItem parameter) { if (parameter == null) { return; } TSZComboBoxCellExtend extend = row.Cells[1] as TSZComboBoxCellExtend; if (extend != null) { var tempControl = parameter.ShowControl; if (tempControl != null && tempControl.IsDropDown) { extend.Numeric = tempControl.IsNumber; extend.Items.AddRange(tempControl.Items ?? new List <object>()); } } row.Tag = parameter; row.Visible = parameter.IsVisible; if (!parameter.IsEnable) { row.Cells[0].Style.ForeColor = Color.DarkGray; row.Cells[1].Style.ForeColor = Color.DarkGray; row.ReadOnly = true; } else { row.Cells[0].Style.ForeColor = Color.Black; row.Cells[1].Style.ForeColor = Color.Black; row.ReadOnly = false; } row.Cells[0].Value = parameter.DisplayName; row.Cells[1].Value = parameter.Value; }