Пример #1
0
        public override void DetachEditingControl()
        {
            DataGridView dataGridView = this.DataGridView;

            if (dataGridView == null || dataGridView.EditingControl == null)
            {
                throw new InvalidOperationException("Cell is detached or its grid has no editing control.");
            }

            TNumEditBox numEditBox = dataGridView.EditingControl as TNumEditBox;

            if (numEditBox != null)
            {
                numEditBox.ClearUndo();  // avoid interferences between the editing sessions
            }

            base.DetachEditingControl();
        }
Пример #2
0
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
            TNumEditBox numEditBox = this.DataGridView.EditingControl as TNumEditBox;

            if (numEditBox != null)
            {
                numEditBox.BorderStyle   = BorderStyle.None;
                numEditBox.DecimalLength = this.DecimalLength;
                numEditBox.AllowNegative = this.AllowNegative;

                string initialFormattedValueStr = initialFormattedValue as string;

                if (string.IsNullOrEmpty(initialFormattedValueStr))
                {
                    numEditBox.Text = m_Min.ToString();
                }
                else
                {
                    numEditBox.Text = initialFormattedValueStr;
                }
            }
        }