Ejemplo n.º 1
0
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);

            NumericUpDownRightEditingControl ctl     = (NumericUpDownRightEditingControl)DataGridView.EditingControl;
            NumericUpDownColumnRight         MyOwner = (NumericUpDownColumnRight)OwningColumn;

            decimal CurrentValue = 0M;

            if (MyOwner.AllowNegative)
            {
                ctl.Minimum = -100;
            }
            else
            {
                ctl.Minimum = 1;
            }

            if (!(DBNull.Value.Equals(this.Value)))
            {
                if (Value == null)
                {
                    return;
                }
                if (decimal.TryParse(this.Value.ToString(), out CurrentValue))
                {
                    ctl.Value = CurrentValue;
                }
            }
            else
            {
                ctl.Value = 0;
            }
        }
Ejemplo n.º 2
0
        public override object Clone()
        {
            NumericUpDownColumnRight TheCopy = (NumericUpDownColumnRight)base.Clone();

            TheCopy.AllowNegative = this.AllowNegative;
            TheCopy.DecimalPlaces = this.DecimalPlaces;

            return(TheCopy);
        }