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

EditorAttribute クラス

プロパティを変更するために使用するエディタを指定します。このクラスは継承できません。

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

<AttributeUsageAttribute(AttributeTargets.All, AllowMultiple:=True, Inherited:=True)>
 _
Public NotInheritable Class
 EditorAttribute
    Inherits Attribute
Dim instance As EditorAttribute
[AttributeUsageAttribute(AttributeTargets.All, AllowMultiple=true,
 Inherited=true)] 
public sealed class EditorAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::All, AllowMultiple=true,
 Inherited=true)] 
public ref class EditorAttribute sealed : public
 Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.All, AllowMultiple=true,
 Inherited=true) */ 
public final class EditorAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.All, AllowMultiple=true,
 Inherited=true) 
public final class EditorAttribute extends
 Attribute
解説解説
使用例使用例

MyImage クラスを作成するコード例を次に示します。このクラスは、エディタとして ImageEditor を指定する EditorAttribute を使用してマークされています。

<Editor("System.Windows.Forms.ImageEditorIndex, System.Design",
 _
    GetType(UITypeEditor))> _
Public Class MyImage
    ' Insert code here.
End Class 'MyImage
[Editor("System.Windows.Forms.ImageEditorIndex, System.Design", 
    typeof(UITypeEditor))]

public class MyImage
{
    // Insert code here.
 }
[Editor("System.Windows.Forms.ImageEditorIndex, System.Design",
UITypeEditor::typeid)]
public ref class MyImage{
   // Insert code here.
};
/** @attribute Editor("System.Windows.Forms.ImageEditorIndex, " 
     + "System.Design", UITypeEditor.class)
 */
public static class MyImage
{
    // Insert code here.
} //MyImage

MyImage クラスのインスタンスを作成し、そのクラスの属性を取得し、myNewImage によって使用されるエディタの名前を出力します。

Public Shared Sub Main()
    ' Creates a new component.
    Dim myNewImage As New
 MyImage()
    
    ' Gets the attributes for the component.
    Dim attributes As AttributeCollection =
 TypeDescriptor.GetAttributes(myNewImage)
    
    ' Prints the name of the editor by retrieving the EditorAttribute
    ' from the AttributeCollection. 
    
    Dim myAttribute As EditorAttribute = CType(attributes(GetType(EditorAttribute)),
 EditorAttribute)
    Console.WriteLine(("The editor for this class is: "
 & myAttribute.EditorTypeName))

End Sub 'Main
public static int Main()
 {
    // Creates a new component.
    MyImage myNewImage = new MyImage();
 
    // Gets the attributes for the component.
    AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewImage);
 
    /* Prints the name of the editor by retrieving the EditorAttribute 
     * from the AttributeCollection. */
    
    EditorAttribute myAttribute = (EditorAttribute)attributes[typeof(EditorAttribute)];
    Console.WriteLine("The editor for this
 class is: " + myAttribute.EditorTypeName);
 
    return 0;
 }
int main()
{
   // Creates a new component.
   MyImage^ myNewImage = gcnew MyImage;

   // Gets the attributes for the component.
   AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewImage );

   /* Prints the name of the editor by retrieving the EditorAttribute 
       * from the AttributeCollection. */
   EditorAttribute^ myAttribute = dynamic_cast<EditorAttribute^>(attributes[
 EditorAttribute::typeid ]);
   Console::WriteLine( "The editor for this
 class is: {0}", myAttribute->EditorTypeName );
   return 0;
}
public static void main(String[]
 args)
{
    // Creates a new component.        
    MyImage myNewImage = new MyImage();

    // Gets the attributes for the component.
    AttributeCollection attributes = 
        TypeDescriptor.GetAttributes(myNewImage);

    /* Prints the name of the editor by retrieving the EditorAttribute 
       from the AttributeCollection. 
     */
    EditorAttribute myAttribute = (EditorAttribute)(
        attributes.get_Item(EditorAttribute.class.ToType()));

    Console.WriteLine("The editor for this
 class is: " 
        + myAttribute.get_EditorTypeName());
} //main
継承階層継承階層
System.Object
   System.Attribute
    System.ComponentModel.EditorAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

EditorAttribute コンストラクタ ()


EditorAttribute コンストラクタ (Type, Type)

型と基本型を指定して、EditorAttribute クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    type As Type, _
    baseType As Type _
)
Dim type As Type
Dim baseType As Type

Dim instance As New EditorAttribute(type,
 baseType)
public EditorAttribute (
    Type type,
    Type baseType
)
public:
EditorAttribute (
    Type^ type, 
    Type^ baseType
)
public EditorAttribute (
    Type type, 
    Type baseType
)
public function EditorAttribute (
    type : Type, 
    baseType : Type
)

パラメータ

type

エディタの型を表す Type。

baseType

エディタを検索するためのキーとして使用する基本クラスまたは基本インターフェイスの Type。このクラスは、UITypeEditor であるか、またはそこから派生している必要があります。

解説解説

type パラメータで表される Type は、基本クラスから派生するか、または基本クラスを実装する必要があります。

1 つのデータ型に複数のエディタを関連付けることができるため、baseType パラメータが特定のエディタを見つけるためのキーとして使用されます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

EditorAttribute コンストラクタ (String, String)

エディタの型名と基本型名を指定して、EditorAttribute クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    typeName As String, _
    baseTypeName As String _
)
Dim typeName As String
Dim baseTypeName As String

Dim instance As New EditorAttribute(typeName,
 baseTypeName)
public EditorAttribute (
    string typeName,
    string baseTypeName
)
public:
EditorAttribute (
    String^ typeName, 
    String^ baseTypeName
)
public EditorAttribute (
    String typeName, 
    String baseTypeName
)
public function EditorAttribute (
    typeName : String, 
    baseTypeName : String
)

パラメータ

typeName

エディタの完全修飾型名。

baseTypeName

エディタを検索するためのキーとして使用する基本クラスまたは基本インターフェイスの完全修飾型名。このクラスは、UITypeEditor であるか、またはそこから派生している必要があります。

解説解説

typeName パラメータは、Type.AssemblyQualifiedName の形式で指定する必要があります。

typeName パラメータで表される Type は、基本クラスから派生するか、または基本クラスを実装する必要があります。

1 つのデータ型に複数のエディタを関連付けることができるため、baseTypeName パラメータが表す Type が、特定のエディタを見つけるためのキーとして使用されます。これには任意のクラスを使用できますが、通常 UITypeEditor または ComponentEditor を使用します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

EditorAttribute コンストラクタ


EditorAttribute コンストラクタ (String, Type)

型名と基本型を指定して、EditorAttribute クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    typeName As String, _
    baseType As Type _
)
Dim typeName As String
Dim baseType As Type

Dim instance As New EditorAttribute(typeName,
 baseType)
public EditorAttribute (
    string typeName,
    Type baseType
)
public:
EditorAttribute (
    String^ typeName, 
    Type^ baseType
)
public EditorAttribute (
    String typeName, 
    Type baseType
)
public function EditorAttribute (
    typeName : String, 
    baseType : Type
)

パラメータ

typeName

エディタの完全修飾型名。

baseType

エディタを検索するためのキーとして使用する基本クラスまたは基本インターフェイスの Type。このクラスは、UITypeEditor であるか、またはそこから派生している必要があります。

解説解説

typeName パラメータは、Type.AssemblyQualifiedName の形式で指定する必要があります。

typeName で表される Type は、基本クラスから派生するか、または基本クラスを実装する必要があります。

1 つのデータ型に複数のエディタを関連付けることができるため、baseType パラメータが特定のエディタを見つけるためのキーとして使用されます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

EditorAttribute プロパティ


EditorAttribute メソッド


パブリック メソッドパブリック メソッド

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

関連項目

EditorAttribute クラス
System.ComponentModel 名前空間

EditorAttribute メンバ

プロパティを変更するために使用するエディタを指定します。このクラスは継承できません。

EditorAttribute データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ EditorBaseTypeName エディタを検索するためのキーとして使用する基本クラスまたは基本インターフェイスの名前を取得します。
パブリック プロパティ EditorTypeName Type.AssemblyQualifiedName 形式のエディタ クラス名を取得します。
パブリック プロパティ TypeId オーバーライドされます。 この属性型の一意の ID を取得します。
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の EditorAttribute と等しいかどうかを示す値を返します。
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。  
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

EditorAttribute クラス
System.ComponentModel 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「EditorAttribute」の関連用語

EditorAttributeのお隣キーワード

   

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



EditorAttributeのページの著作権

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

©2026 GRAS Group, Inc.RSS