在“属性"窗口中隐藏“类别" [英] Hiding a 'Category' in the Properties Window
问题描述
我知道几种隐藏单个属性的方法,在我正在做的事情中,我使用Designer
来做到这一点,更具体地说,是通过覆盖PreFilterProperties
方法
I know several ways to hide individual properties, and in something I''m working on I do it using a Designer
, more specifically by overriding the PreFilterProperties
method
<br /> protected override void PreFilterProperties(System.Collections.IDictionary properties)<br /> {<br /> properties.Remove("Dock");<br /> properties.Remove("TabStop");<br /> properties.Remove("TabIndex");<br /> properties.Remove("Visible");<br /> properties.Remove("Enabled");<br /> properties.Remove("Locked"); <===========================================================<br /> properties.Remove("Anchor");<br /> properties.Remove("Name"); <===========================================================<br /> properties.Remove("AutoSize");<br /> properties.Remove("AutoSizeMode");<br /> properties.Remove("Location");<br /> properties.Remove("Size");<br /> properties.Remove("MaximumSize");<br /> properties.Remove("MinimumSize");<br /> properties.Remove("BorderStyle");<br /> properties.Remove("GenerateMember");<br /> properties.Remove("Modifiers");<br /> properties.Remove("Design");<br /><br /> base.PreFilterProperties(properties);<br /> }<br />
但是标记的两个属性仍然显示. [confused]
它们都在设计"类别中,因此即使上面的代码有效,我仍然会留有一个空的类别.因此,
1)任何人都对为什么保留这两个属性和/或如何去除这两个属性有任何想法.
2)任何想法有关如何删除设计"类别的信息.如果您查看SplitContainer
中的任何Panels
,则它们没有设计类别,因此大概是可行的.
The two properties marked still show up however. [confused]
They are both in the ''Design'' Category, so even if the code above worked, I would still be left with an empty Category. So
1) anybody got any ideas about why the two properties remain and/or how to get rid of them.
2) any ideas on how to remove the ''Design'' Category. If you look at either of the Panels
in a SplitContainer
, they don''t have a Design Category, so presumably it is possible.
推荐答案
您好,亨利爵士,
我的卧底线人告诉我SplitContainer面板的秘密在这一行: >[EditorBrowsable(EditorBrowsableState.Never), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
希望有所帮助.
:)
Hello Sir Henry,
my undercover informant told me the secret of SplitContainer panels is in this line:
Hope that helps.
:)
这篇关于在“属性"窗口中隐藏“类别"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!