IDesignerFilter.PreFilterAttributes(IDictionary) 方法

定義

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

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

參數

attributes
IDictionary

元件類別的 Attribute 物件。 屬性字典中索引鍵為屬性的 TypeId 值。

備註

這個方法提供方法,將專案加入至實作這個介面之設計工具相關聯元件的屬性字典中,會透過 TypeDescriptor公開。

屬性字典中的索引鍵是屬性的類型識別碼。 物件的類型為 Attribute。 這個方法會在 之前 PostFilterAttributes立即呼叫。

屬性的類型識別碼可以是任何物件。 根據預設, Attribute 會傳回 其 Type 做為其 屬性的值 TypeId 。 您可以在字典中檢查 TypeId 屬性的 ,以取得與屬性識別其已知 TypeId 相等的屬性,或使用 System.Reflection 來識別屬性物件本身。

將與現有或繼承屬性相同的 TypeId 屬性新增至元件時,新屬性會取代舊屬性。 對於許多屬性,相同類型的新屬性將會取代類型的任何先前屬性。 不過,某些類型的屬性會傳回 TypeId 選擇性區分屬性的 。 例如,為了為型別提供不同類型的同時作用中設計工具,例如 IRootDesignerIDesigner,類別會 DesignerAttribute 傳回可唯一 TypeId 識別屬性和基底設計工具類型的 。 建 DesignerAttribute 構函式可讓您指定設計工具的基底設計工具類型,以及其特定型別,並 DesignerAttribute 傳回 TypeId 反映此專案的 。 因此,當您使用與現有 DesignerAttribute基底設計工具類型的基底設計工具類型相同的基底設計工具類型加入新的 DesignerAttribute 時,舊屬性會取代為新的屬性。

給實施者的注意事項

您可以直接篩選可透過 參數存取的 attributes 字典,也可以讓字典保持不變。 如果您要覆寫此方法,請在執行自己的篩選之後呼叫基底實作。

適用於

另請參閱