IDesignerFilter IDesignerFilter IDesignerFilter IDesignerFilter Interface

定義

提供可以讓設計工具存取和篩選 TypeDescriptor 物件字典的介面,在該物件中儲存了屬性 (Property)、屬性 (Attribute) 甚至是元件設計工具可公開至設計階段環境的事件描述項。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 可讓設計工具篩選其相關聯的元件會透過公開的屬性、 屬性和事件描述元組TypeDescriptorIDesignerFilter enables a designer to filter the set of property, attribute, and event descriptors that its associated component exposes through a TypeDescriptor. 這個介面的方法名稱開頭Pre立即前名稱開頭的方法受到呼叫PostThe methods of this interface whose names begin with Pre are called immediately before the methods whose names begin with Post.

如果您想要新增屬性、 事件或屬性描述元,使用PreFilterAttributesPreFilterEvents,或PreFilterProperties方法。If you want to add attribute, event, or property descriptors, use a PreFilterAttributes, PreFilterEvents, or PreFilterProperties method.

如果您想要變更或移除屬性、 事件或屬性的描述元,使用PostFilterAttributesPostFilterEvents,或PostFilterProperties方法。If you want to change or remove attribute, event, or property descriptors, use a PostFilterAttributes, PostFilterEvents, or PostFilterProperties method.

方法

PostFilterAttributes(IDictionary) PostFilterAttributes(IDictionary) PostFilterAttributes(IDictionary) 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) PostFilterEvents(IDictionary) PostFilterEvents(IDictionary) 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) PostFilterProperties(IDictionary) PostFilterProperties(IDictionary) 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) PreFilterAttributes(IDictionary) PreFilterAttributes(IDictionary) 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) PreFilterEvents(IDictionary) PreFilterEvents(IDictionary) 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) PreFilterProperties(IDictionary) PreFilterProperties(IDictionary) 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.

適用於

另請參閱