首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

为啥继承自DataGridViewColumn的自定义Column总是无法保存属性值

2012-10-19 
为什么继承自DataGridViewColumn的自定义Column总是无法保存属性值public class TXDataGridViewNumericCol

为什么继承自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

热点排行