IDesignerFilter.PostFilterAttributes(IDictionary) 方法


当在派生类中被重写后,允许设计器更改或移除它通过 TypeDescriptor 公开的特性集中的项。When overridden in a derived class, allows a designer to change or remove items from the set of attributes that it exposes through a TypeDescriptor.

 void PostFilterAttributes(System::Collections::IDictionary ^ attributes);
public void PostFilterAttributes (System.Collections.IDictionary attributes);
abstract member PostFilterAttributes : System.Collections.IDictionary -> unit
Public Sub PostFilterAttributes (attributes As IDictionary)



组件的类的 Attribute 对象。The Attribute objects for the class of the component. 特性字典中的关键字是特性的 TypeId 值。The keys in the dictionary of attributes are the TypeId values of the attributes.


此方法提供了一种方法,用于更改或移除属性字典中的项,实现此接口的设计器的关联组件通过 TypeDescriptor公开。This method provides a way to change or remove items within the dictionary of attributes that the associated component of the designer implementing this interface exposes through a TypeDescriptor.

属性字典中的键是属性的类型 Id。The keys in the dictionary of attributes are the type IDs of the attributes. 对象的类型为 AttributeThe objects are of type Attribute. PreFilterAttributes后立即调用此方法。This method is called immediately after PreFilterAttributes.

特性的类型 ID 可以是任何对象。The type ID of an attribute can be any object. 默认情况下,Attribute 会将其 Type 作为其 TypeId 属性的值返回。By default, Attribute returns its Type as the value of its TypeId property. 您可以检查字典中某个属性的 TypeId 是否与已知的属性(用于标识属性的已知 TypeId)相等,或使用 System.Reflection 标识特性对象本身。You can check the TypeId of an attribute in the dictionary for equivalence with a known TypeId for an attribute to identify it, or use System.Reflection to identify the attribute object itself.

如果将具有与现有或继承的属性相同的 TypeId 的属性添加到组件中,新属性将替换旧属性。When an attribute that has the same TypeId as an existing or inherited attribute is added to a component, the new attribute replaces the old attribute. 对于很多特性,相同类型的新属性将替换该类型的任何以前的特性。For many attributes, a new attribute of the same type will replace any previous attribute of the type. 但是,某些类型的属性会返回一个可有选择地区分该属性的 TypeIdHowever, some types of attributes return a TypeId that distinguishes the attribute selectively. 例如,若要为某一类型(如 IRootDesignerIDesigner)提供不同类型的同时处于活动状态的设计器,DesignerAttribute 类将返回唯一标识该属性和基本设计器类型的 TypeIdFor example, in order to provide different types of simultaneously active designers for a type, such as an IRootDesigner and an IDesigner, the DesignerAttribute class returns a TypeId that uniquely identifies both the attribute and the base designer type. DesignerAttribute 构造函数允许除了特定类型外,还指定设计器的基设计器类型,DesignerAttribute 返回反映此的 TypeIdThe DesignerAttribute constructor allows you to specify the base designer type of the designer in addition to its specific type, and DesignerAttribute returns a TypeId that reflects this. 因此,当使用与现有 DesignerAttribute的基本设计器类型相同的类型的基设计器类型添加新的 DesignerAttribute 时,旧属性将替换为新特性。Therefore when you add a new DesignerAttribute with a base designer type of the same type as the base designer type of an existing DesignerAttribute, the old attribute is replaced with the new attribute.


可以直接筛选可通过 attributes 参数访问的字典,也可以将其保持不变。You can directly filter the dictionary that is accessible through the attributes parameter, or you can leave it unchanged. 如果要重写此方法,请在执行您自己的筛选后调用基实现。If you are overriding this method, call the base implementation after you perform your own filtering.