IDesignerFilter 接口

定义

提供一个接口,使设计器能够访问和筛选存储组件设计器可向设计时环境公开的属性、属性和事件描述符的字典 TypeDescriptor

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

示例

以下示例演示了在设计时选择设计器控件时向属性窗口添加设计器属性的 PreFilterProperties的替代。 ControlDesigner有关使用该IDesignerFilter接口的完整设计器示例,请参阅该类的示例。

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 使设计器能够筛选其关联组件通过 a TypeDescriptor公开的属性、属性和事件描述符集。 此接口的方法,其名称以名称开头 Pre 的方法在名称以 Post开头的方法之前立即调用。

如果要添加属性、事件或属性描述符,请使用或PreFilterAttributesPreFilterEventsPreFilterProperties方法。

如果要更改或删除属性、事件或属性描述符,请使用或PostFilterAttributesPostFilterEventsPostFilterProperties方法。

方法

名称 说明
PostFilterAttributes(IDictionary)

在派生类中重写时,允许设计器更改或删除通过派 TypeDescriptor生类公开的属性集中的项。

PostFilterEvents(IDictionary)

在派生类中重写时,允许设计器更改或删除通过派 TypeDescriptor生类公开的事件集中的项。

PostFilterProperties(IDictionary)

在派生类中重写时,允许设计器更改或删除通过派 TypeDescriptor生类公开的属性集中的项。

PreFilterAttributes(IDictionary)

在派生类中重写时,允许设计器将项添加到通过派 TypeDescriptor生类公开的属性集。

PreFilterEvents(IDictionary)

在派生类中重写时,允许设计器将项添加到通过派 TypeDescriptor生类公开的事件集。

PreFilterProperties(IDictionary)

在派生类中重写时,允许设计器将项添加到通过派 TypeDescriptor生类公开的属性集。

适用于

另请参阅