IDesignerFilter 介面

定義

提供可以讓設計工具存取和篩選 TypeDescriptor 物件字典的介面,在該物件中儲存了屬性 (Property)、屬性 (Attribute) 甚至是元件設計工具可公開至設計階段環境的事件描述項。

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

範例

下列範例示範 的覆寫PreFilterProperties,它會在設計時間選取設計工具的控件時,將設計工具的 屬性新增至 屬性視窗。 如需使用 IDesignerFilter 介面的完整設計工具範例,請參閱 類別的範例ControlDesigner

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公開的屬性、屬性和事件描述元集。 這個介面的方法,其名稱開頭 Pre 為的方法,緊接在名稱開頭 Post為 的方法之前。

如果您要新增屬性、事件或屬性描述元,請使用 PreFilterAttributesPreFilterEventsPreFilterProperties 方法。

如果您想要變更或移除屬性、事件或屬性描述元,請使用 PostFilterAttributesPostFilterEventsPostFilterProperties 方法。

方法

PostFilterAttributes(IDictionary)

在衍生類別中覆寫時,允許設計工具可以變更或移除透過 TypeDescriptor 所公開之屬性集中的項目。

PostFilterEvents(IDictionary)

在衍生類別中覆寫時,允許設計工具可以變更或移除透過 TypeDescriptor 所公開之屬性集中的項目。

PostFilterProperties(IDictionary)

在衍生類別中覆寫時,允許設計工具可以變更或移除透過 TypeDescriptor 所公開之屬性集中的項目。

PreFilterAttributes(IDictionary)

在衍生類別中覆寫時,允許設計工具可以將項目加入到透過 TypeDescriptor 公開的屬性集。

PreFilterEvents(IDictionary)

在衍生類別中覆寫時,允許設計工具可以將項目加入到透過 TypeDescriptor 公開的事件集。

PreFilterProperties(IDictionary)

在衍生類別中覆寫時,允許設計工具可以將項目加入到透過 TypeDescriptor 公開的屬性集。

適用於

另請參閱