对于易混淆的标题感到抱歉。 我对Spreads使用第三方控件,它有一个comboBoxCellType()。 在我的代码有喜欢的20个地方,我有这样的代码:找到将财产应用于代码的最佳方式
ComboBoxCellType cbo = new ComboBoxCellType()
cbo.OtherStuff...
现在我想这样的代码的所有出现次数有所谓的额外的属性listwidth = 0;所以 类似:
ComboBoxCellType cbo = new ComboBoxCellType()
cbo.listwidth=0;
cbo.OtherStuff
一个办法就是搜索代码和手动添加。但我想知道是否有更好的方法使用继承和重写来做到这一点?
然后,您可以使用ComboBoxCellType cbo = ComboBoxCellTypeFactory.Create()来搜索/替换'ComboBoxCellType cbo = new ComboBoxCellType();'的实例。 –
谢谢,我现在就试试吧...... – Bohn
嗯..这个编译错误是什么? “静态类'MyApplication.ComboBoxCellTypeFactor'不能从类型'FarPoint.Win.Spread.CellType.ComboBoxCellType'派生,静态类必须从对象派生。” – Bohn