IDesignerFilter 接口

定义

提供使设计器能够访问和筛选 TypeDescriptor 字典的接口,它存储组件设计器可以向设计时环境公开的属性、特性和事件说明符。Provides an interface that enables a designer to access and filter the dictionaries of a TypeDescriptor that stores the property, attribute, and event descriptors that a component designer can expose to the design-time environment.

public interface class IDesignerFilter
public interface IDesignerFilter
type IDesignerFilter = interface
Public Interface IDesignerFilter
派生

示例

下面的示例演示在设计时选择设计器的控件时,将设计器的属性添加到属性窗口 PreFilterProperties 的重写。The following example demonstrates an override of PreFilterProperties that adds a property of the designer to the Properties window when the designer's control is selected at design time. 请参阅 ControlDesigner 类的示例,了解使用 IDesignerFilter 接口的完整设计器示例。See the example for the ControlDesigner class for a complete designer example that uses the IDesignerFilter interface.

protected:
   [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)]
   virtual void PreFilterProperties( System::Collections::IDictionary^ properties ) override
   {
      properties->Add( "OutlineColor", TypeDescriptor::CreateProperty( TestControlDesigner::typeid, "OutlineColor", System::Drawing::Color::typeid, nullptr ) );
   }
// Adds a property to this designer's control at design time 
// that indicates the outline color to use. 
// The DesignOnlyAttribute ensures that the OutlineColor
// property is not serialized by the designer.
protected override void PreFilterProperties(System.Collections.IDictionary properties)
{
    PropertyDescriptor pd = TypeDescriptor.CreateProperty(
        typeof(ExampleControlDesigner), 
        "OutlineColor",
        typeof(System.Drawing.Color),
        new Attribute[] { new DesignOnlyAttribute(true) });

    properties.Add("OutlineColor", pd);
}
' Adds a property to this designer's control at design time 
' that indicates the outline color to use.
' The DesignOnlyAttribute ensures that the OutlineColor
' property is not serialized by the designer.
Protected Overrides Sub PreFilterProperties(ByVal properties As System.Collections.IDictionary)
    Dim pd As PropertyDescriptor = TypeDescriptor.CreateProperty( _
    GetType(ExampleControlDesigner), _
    "OutlineColor", _
    GetType(System.Drawing.Color), _
    New Attribute() {New DesignOnlyAttribute(True)})

    properties.Add("OutlineColor", pd)
End Sub

注解

IDesignerFilter 使设计器可以筛选其关联组件通过 TypeDescriptor公开的属性、特性和事件说明符集。IDesignerFilter enables a designer to filter the set of property, attribute, and event descriptors that its associated component exposes through a TypeDescriptor. 此接口的名称以 Pre 开头的方法立即在名称以 Post开头的方法之前调用。The methods of this interface whose names begin with Pre are called immediately before the methods whose names begin with Post.

如果要添加特性、事件或属性说明符,请使用 PreFilterAttributesPreFilterEventsPreFilterProperties 方法。If you want to add attribute, event, or property descriptors, use a PreFilterAttributes, PreFilterEvents, or PreFilterProperties method.

若要更改或删除属性、事件或属性描述符,请使用 PostFilterAttributesPostFilterEventsPostFilterProperties 方法。If you want to change or remove attribute, event, or property descriptors, use a PostFilterAttributes, PostFilterEvents, or PostFilterProperties method.

方法

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.

PostFilterEvents(IDictionary)

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

PostFilterProperties(IDictionary)

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

PreFilterAttributes(IDictionary)

当在派生类中被重写时,允许设计器将项添加到它通过 TypeDescriptor 公开的特性集中。When overridden in a derived class, allows a designer to add items to the set of attributes that it exposes through a TypeDescriptor.

PreFilterEvents(IDictionary)

当在派生类中被重写时,允许设计器将项添加到它通过 TypeDescriptor 公开的事件集中。When overridden in a derived class, allows a designer to add items to the set of events that it exposes through a TypeDescriptor.

PreFilterProperties(IDictionary)

当在派生类中被重写时,允许设计器将项添加到它通过 TypeDescriptor 公开的属性集中。When overridden in a derived class, allows a designer to add items to the set of properties that it exposes through a TypeDescriptor.

适用于

另请参阅