如何获得WinForm设计完全忽视在自定义控件的属性? [英] How do I get the WinForm Designer to totally ignore a property on a custom control?
问题描述
这必须是一个常见问题,但我不能找到一个重复的问题!的
有很多控制在WinForm设计器与一个自定义的控件的属性有什么不同属性的,我从来没有明确的一个我应该在这种情况下使用。
There are lot of different attributes that control what the WinForm Designer does with properties on a custom control, I am never clear on the one I should use in this case.
我要找:
- 在设计器不显示网格属性
- 在设计器不读取属性值
- 在设计器不设置属性为默认值
- 例如。设计师的行为就好像该属性的是不存在
- 在设计器不抱怨,如果它已经做好了上述之一的属性被添加之前(硬!)
- Designer does not show property in grid
- Designer does not read value of property
- Designer does not set property to default value
- E.g. Designer behaves as if the property was not there.
- Designer does not complain if it has already done one of the above before the attributes were added (hard!)
背景。
在code,它是给我的问题是:
The code that is giving me the problem is:
this.eventListControl.FilterSets =
((SystList<FilterSet>)(resources.GetObject("eventListControl.FilterSets")));
在FilterSets属性不应该被感动了的WinForms设计师;现在是不是序列化和MSDEV每次使用的eventListControl形式改变时倒了!
The FilterSets property should never have been touched by the winforms designer; it is now not Serializable and MsDev falls over every time a form that used the eventListControl is changed!
推荐答案
我想你可以使用 [可浏览(假)]
和 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
第二个属性$ P $出现在的InitializeComponent
The second attribute prevents the property from appearing in InitializeComponent
这篇关于如何获得WinForm设计完全忽视在自定义控件的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!