Пример #1
0
        public override void InitializeEditingControl(int rowIndex, object
                                                      initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            // Set the value of the editing control to the current cell value.

            NumericTextBoxDataGridViewControl ctl =
                DataGridView.EditingControl as NumericTextBoxDataGridViewControl;
            DataGridViewColumn dgvc = this.OwningColumn;

            if (dgvc is NumericTextBoxDataGridViewColumn)
            {
                NumericTextBoxDataGridViewColumn rtvc = dgvc as NumericTextBoxDataGridViewColumn;
                ctl.MaxWholeDigits      = rtvc.MaxWholeDigits;
                ctl.MaxDecimalPlaces    = rtvc.MaxDecimalPlaces;
                ctl.AllowNegative       = rtvc.AllowNegative;
                ctl.AllowGroupSeparator = rtvc.AllowGroupSeparator;
                ctl.RangeMax            = rtvc.RangeMax;
                ctl.RangeMin            = rtvc.RangeMin;
                ctl.Prefix     = rtvc.Prefix;
                ctl.ShowPrefix = rtvc.ShowPrefix;
            }
            ctl.Text = initialFormattedValue as string;

            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
        }
Пример #2
0
        public override object Clone()
        {
            NumericTextBoxDataGridViewColumn column = (NumericTextBoxDataGridViewColumn)base.Clone();

            column._MaxWholeDigits      = _MaxWholeDigits;
            column._MaxDecimalPlaces    = _MaxDecimalPlaces;
            column._AllowNegative       = _AllowNegative;
            column._AllowGroupSeparator = _AllowGroupSeparator;
            column._RangeMax            = _RangeMax;
            column._RangeMin            = _RangeMin;
            column._Prefix     = _Prefix;
            column._ShowPrefix = ShowPrefix;
            return(column);
        }