Beispiel #1
0
        protected override void OnCellValueChanged(DataGridViewCellEventArgs e)
        {
            base.OnCellValueChanged(e);
            var           cellEdit = this.Rows[e.RowIndex].Cells[e.ColumnIndex];
            ParameterItem item     = cellEdit.Tag as ParameterItem;

            if (item != null)
            {
                item.Value = cellEdit.Value;
                UpdateEditor();
            }
        }
Beispiel #2
0
        private void SetEditor(DataGridViewRow row, ParameterItem parameter, DataGridViewCell secondCell)
        {
            row.Cells[1]   = secondCell;
            secondCell.Tag = parameter;
            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;
            }

            row.Cells[0].Value = parameter.DisplayName;
            row.Cells[1].Value = parameter.Value;
        }
Beispiel #3
0
        protected override void OnSelectionChanged(EventArgs e)
        {
            base.OnSelectionChanged(e);
            #region 控制灰显的不能被选中
            try
            {
                if (this.CurrentCell != null)
                {
                    var           row  = this.Rows[this.CurrentCell.RowIndex];
                    ParameterItem item = row.Tag as ParameterItem;

                    if (item != null && !item.IsEnable)
                    {
                        this.CurrentCell = null;
                    }
                }
            }
            catch (Exception)
            {
            }
            #endregion
        }
Beispiel #4
0
        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;
        }