PropertyGridObject.GetProperties(Attribute[]) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した属性の配列をフィルターとして使用して、プロパティ グリッドのプロパティのコレクションを返します。
protected:
virtual System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(cli::array <Attribute ^> ^ attributes);
protected virtual System.ComponentModel.PropertyDescriptorCollection GetProperties (Attribute[] attributes);
abstract member GetProperties : Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
override this.GetProperties : Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Protected Overridable Function GetProperties (attributes As Attribute()) As PropertyDescriptorCollection
パラメーター
戻り値
指定 PropertyDescriptorCollection したコンポーネントの指定した属性に一致するプロパティを格納している オブジェクト。
実装
例
次の例では、 メソッドを GetProperties 使用して、プロパティ グリッドのプロパティ コレクションを取得します。
protected override PropertyDescriptorCollection
GetProperties(Attribute[] attributes) {
PropertyDescriptorCollection PDC =
base.GetProperties(attributes);
ArrayList properties = new ArrayList();
Type thisType = GetType();
foreach (PropertyDescriptor pd in PDC) {
AttributeCollection attributCol = pd.Attributes;
// Display Name Attribute (DNA)
MyDNAttribute dna = (MyDNAttribute)
(attributCol[typeof(MyDNAttribute)]);
if (dna != null) {
DisplayNameAttribute newDNA =
GetDisplayNameAttribute(
dna.Description,
String.Empty
);
properties.Add(
TypeDescriptor.CreateProperty(
thisType, pd, newDNA
));
} else {
properties.Add(pd);
}
}
PDC = new PropertyDescriptorCollection((PropertyDescriptor[])
properties.ToArray(typeof(PropertyDescriptor)));
return PDC;
}
注釈
プロパティがプロパティ グリッドに表示される前に、オブジェクトのプロパティを System.ComponentModel.PropertyDescriptorCollection 変更するには、このメソッドをオーバーライドできます。