有条件的"可浏览"属性 [英] Conditional "Browsable" Attribute
问题描述
结果
有没有办法做一个可浏览属性的条件,从而使应用有时会出现在属性页,有时不是财产?结果
感谢:)
Is there a way to make a "Browsable" attribute conditional, so the property that applies it will sometimes appear in the properties page and sometimes not?
thanks :)
推荐答案
有没有简单的方法。
您都不可能通过实现ICustomTypeDescriptor工作了这一点。下面是一些关于实施ICustomTypeDescriptor 的好文章。
You can possibly work this out by implementing ICustomTypeDescriptor. Here is a good article about implementing ICustomTypeDescriptor.
或者你可以关联自己的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.design.controldesigner.aspx\">ControlDesigner与你的类并重写<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.design.controldesigner.$p$pfilterproperties.aspx\">$p$pFilterProperties方法来添加或删除属性网格中查看属性。
Or you can associate your own ControlDesigner with your class and override the PreFilterProperties method to add or remove properties viewed in the property grid.
<一个href=\"http://stackoverflow.com/questions/1479539/removing-certain-properties-in-a-user-control-i-e-forcing-one-value-and-not-edi\">Removing某些属性的属性网格。
这篇关于有条件的&QUOT;可浏览&QUOT;属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!