日期:2014-05-17  浏览次数:20822 次

为什么继承自DataGridViewColumn的自定义Column总是无法保存属性值
public class TXDataGridViewNumericColumn : DataGridViewColumn
  {
  public TXDataGridViewNumericColumn() : base(new TXNumericCell())
  {
  this.InputType = NumericType.Integer; 
  this.CellTemplate=new TXNumericCell(); 
  }
   
  public override DataGridViewCell CellTemplate
  {
  get
  {
  return base.CellTemplate;
  }
  set
  {
  if (value != null &&
  !value.GetType().IsAssignableFrom(typeof(TXNumericCell)))
  {
  throw new InvalidCastException("Must be a NumericCell");
  }
  base.CellTemplate = value;
  }

  }

  private NumericType m_NumericType;

   
  public enum NumericType
  {
  Decimal,
  Integer,
  PositiveDecimal,
  NegativeDecimal,
  PositiveInteger,
  NegativeInteger
  }

   
  public NumericType InputType
  {
  get { return m_NumericType; }
  set { m_NumericType = value; }
  }
}

当在datagridview的列编辑器中选择列的InputType属性时(在设计模式时),其值不可以保存?请问哪里有问题?谢谢!

------解决方案--------------------
shoud be a bug of your code