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 名前空間



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

辞書ショートカット

すべての辞書の索引

「EditorAttribute」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS