DesignerCategoryAttribute クラス
アセンブリ: System (system.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple:=False, Inherited:=True)> _ Public NotInheritable Class DesignerCategoryAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=false, Inherited=true)] public sealed class DesignerCategoryAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple=false, Inherited=true)] public ref class DesignerCategoryAttribute sealed : public Attribute

ビジュアル デザイナは、デザイナ カテゴリを使用して、実装するデザイナの型を開発環境に通知できます。クラスにデザイナ カテゴリが提供されていない場合、開発環境では、そのクラスをデザインできる場合とできない場合があります。任意の名前のカテゴリを作成できます。
この属性でクラスをマークすると、属性は定数メンバに設定されます。コードでこの属性の値を確認するには、定数メンバを指定する必要があります。次の表の "説明" 列に、各値に設定される定数メンバを示します。
DesignerCategoryAttribute クラスは、次の共通カテゴリを定義します。

MyForm というクラスを作成する方法を次の例に示します。MyForm には、このクラスが DocumentDesigner を使用することを指定する DesignerAttribute と、Form カテゴリを指定する DesignerCategoryAttribute という 2 つの属性があります。
<Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design", _ GetType(IRootDesigner)), DesignerCategory("Form")> _ Public Class MyForm Inherits ContainerControl ' Insert code here. End Class 'MyForm
[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design" , typeof(IRootDesigner)), DesignerCategory("Form")] public class MyForm : ContainerControl { // Insert code here. }
[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design" , IRootDesigner::typeid), DesignerCategory("Form")] ref class MyForm: public ContainerControl{ // Insert code here. };
/** @attribute Designer("System.Windows.Forms.Design.DocumentDesigner, " + "System.Windows.Forms.Design", IRootDesigner.class) @attribute DesignerCategory("Form") */ public static class MyForm extends ContainerControl { // Insert code here. } //MyForm
MyForm のインスタンスを作成する例を次に示します。そのクラスの属性を取得し、DesignerCategoryAttribute を抽出してから、デザイナの名前を出力します。
Public Shared Function Main() As Integer ' Creates a new form. Dim myNewForm As New MyForm() ' Gets the attributes for the collection. Dim attributes As AttributeCollection = TypeDescriptor.GetAttributes(myNewForm) ' Prints the name of the designer by retrieving the ' DesignerCategoryAttribute from the AttributeCollection. Dim myAttribute As DesignerCategoryAttribute = _ CType(attributes(GetType(DesignerCategoryAttribute)), DesignerCategoryAttribute) Console.WriteLine(("The category of the designer for this class is: " + myAttribute.Category)) Return 0 End Function 'Main
public static int Main() { // Creates a new form. MyForm myNewForm = new MyForm(); // Gets the attributes for the collection. AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewForm); /* Prints the name of the designer by retrieving the * DesignerCategoryAttribute from the AttributeCollection. */ DesignerCategoryAttribute myAttribute = (DesignerCategoryAttribute)attributes[typeof(DesignerCategoryAttribute)]; Console.WriteLine("The category of the designer for this class is: " + myAttribute.Category); return 0; }
int main() { // Creates a new form. MyForm^ myNewForm = gcnew MyForm; // Gets the attributes for the collection. AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewForm ); /* Prints the name of the designer by retrieving the * DesignerCategoryAttribute from the AttributeCollection. */ DesignerCategoryAttribute^ myAttribute = dynamic_cast<DesignerCategoryAttribute^>(attributes[ DesignerCategoryAttribute::typeid ]); Console::WriteLine( "The category of the designer for this class is: {0}", myAttribute->Category ); return 0; }
public static void main(String[] args) { // Creates a new form. MyForm myNewForm = new MyForm(); // Gets the attributes for the collection. AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewForm); /* Prints the name of the designer by retrieving the DesignerCategoryAttribute from the AttributeCollection. */ DesignerCategoryAttribute myAttribute = (DesignerCategoryAttribute)( attributes.get_Item(DesignerCategoryAttribute.class.ToType())); Console.WriteLine("The category of the designer " + "for this class is: " + myAttribute.get_Category()); } //main

System.Attribute
System.ComponentModel.DesignerCategoryAttribute


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DesignerCategoryAttribute コンストラクタ ()
アセンブリ: System (system.dll 内)


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DesignerCategoryAttribute コンストラクタ (String)
アセンブリ: System (system.dll 内)


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DesignerCategoryAttribute コンストラクタ

名前 | 説明 |
---|---|
DesignerCategoryAttribute () | 空の文字列 ("") を使用して、DesignerCategoryAttribute クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
DesignerCategoryAttribute (String) | 指定したカテゴリ名を使用して、DesignerCategoryAttribute クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |

DesignerCategoryAttribute フィールド
DesignerCategoryAttribute プロパティ
DesignerCategoryAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の DesignOnlyAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 対象のインスタンスのハッシュ コードを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 この属性が既定値かどうかを判断します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

DesignerCategoryAttribute メンバ
クラスのデザイナが特定のカテゴリに属していることを指定します。
DesignerCategoryAttribute データ型で公開されるメンバを以下の表に示します。




名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の DesignOnlyAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 対象のインスタンスのハッシュ コードを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 この属性が既定値かどうかを判断します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- DesignerCategoryAttributeのページへのリンク