/// <summary>
        /// Clones a DataGridViewNumericUpDownCell cell, copies all the custom properties.
        /// </summary>
        public override object Clone()
        {
            DataGridViewNumericUpDownCell dataGridViewCell = base.Clone() as DataGridViewNumericUpDownCell;

            if (dataGridViewCell != null)
            {
                dataGridViewCell.DecimalPlaces      = DecimalPlaces;
                dataGridViewCell.Increment          = Increment;
                dataGridViewCell.Maximum            = Maximum;
                dataGridViewCell.Minimum            = Minimum;
                dataGridViewCell.ThousandsSeparator = ThousandsSeparator;
            }
            return(dataGridViewCell);
        }
Пример #2
0
 /// <summary>
 /// Method called by the grid before the editing control is shown so it can adapt to the
 /// provided cell style.
 /// </summary>
 public virtual void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle)
 {
     Font = dataGridViewCellStyle.Font;
     if (dataGridViewCellStyle.BackColor.A < 255)
     {
         // The NumericUpDown control does not support transparent back colors
         Color opaqueBackColor = Color.FromArgb(255, dataGridViewCellStyle.BackColor);
         BackColor = opaqueBackColor;
         _dataGridView.EditingPanel.BackColor = opaqueBackColor;
     }
     else
     {
         BackColor = dataGridViewCellStyle.BackColor;
     }
     ForeColor = dataGridViewCellStyle.ForeColor;
     TextAlign = DataGridViewNumericUpDownCell.TranslateAlignment(dataGridViewCellStyle.Alignment);
 }