DesignerCategoryAttributeとは? わかりやすく解説

DesignerCategoryAttribute クラス

クラスデザイナ特定のカテゴリ属していることを指定します

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple:=False, Inherited:=True)>
 _
Public NotInheritable Class
 DesignerCategoryAttribute
    Inherits Attribute
Dim instance As DesignerCategoryAttribute
[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
/** @attribute AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=false,
 Inherited=true) */ 
public final class DesignerCategoryAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=false,
 Inherited=true) 
public final class DesignerCategoryAttribute
 extends Attribute
解説解説
使用例使用例

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.Object
   System.Attribute
    System.ComponentModel.DesignerCategoryAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DesignerCategoryAttribute コンストラクタ ()


DesignerCategoryAttribute コンストラクタ (String)


DesignerCategoryAttribute コンストラクタ

DesignerCategoryAttribute クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
DesignerCategoryAttribute () 空の文字列 ("") を使用してDesignerCategoryAttribute クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

DesignerCategoryAttribute (String) 指定したカテゴリ名を使用してDesignerCategoryAttribute クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

参照参照

関連項目

DesignerCategoryAttribute クラス
DesignerCategoryAttribute メンバ
System.ComponentModel 名前空間

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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DesignerCategoryAttribute クラス
System.ComponentModel 名前空間
Attribute
DesignerAttribute クラス

DesignerCategoryAttribute メンバ

クラスデザイナ特定のカテゴリ属していることを指定します

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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DesignerCategoryAttribute クラス
System.ComponentModel 名前空間
Attribute
DesignerAttribute クラス



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DesignerCategoryAttribute」の関連用語

DesignerCategoryAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DesignerCategoryAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS