EditorAttribute クラス

定義

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

public ref class EditorAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=true, Inherited=true)]
public sealed class EditorAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=true, Inherited=true)>]
type EditorAttribute = class
    inherit Attribute
Public NotInheritable Class EditorAttribute
Inherits Attribute
継承
EditorAttribute
属性

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

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

public class MyImage
{
    // Insert code here.
 }
<Editor("System.Windows.Forms.ImageEditorIndex, System.Design", _
    GetType(UITypeEditor))> _
Public Class MyImage
    ' Insert code here.
End Class

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

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 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;
 }
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

注釈

プロパティを編集する場合、ビジュアル デザイナーは、ダイアログ ボックスまたはドロップダウン ウィンドウを使用して、指定したエディターの新しいインスタンスを作成する必要があります。

プロパティを使用して、 EditorBaseTypeName このエディターの基本型を見つけます。 使用可能な基本型は のみです UITypeEditor

プロパティを EditorTypeName 使用して、この属性に関連付けられているエディターの種類の名前を取得します。

属性の使用に関する一般的な情報。 「属性」を参照してください。 デザイン時の属性の詳細については、「 属性とDesign-Timeサポート」を参照してください。

コンストラクター

EditorAttribute()

既定のエディターを指定して、EditorAttribute クラスの新しいインスタンスを初期化します。つまり、エディターは指定されません。

EditorAttribute(String, String)

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

EditorAttribute(String, Type)

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

EditorAttribute(Type, Type)

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

プロパティ

EditorBaseTypeName

エディターを検索するためのキーとして使用する基本クラスまたは基本インターフェイスの名前を取得します。

EditorTypeName

AssemblyQualifiedName 形式のエディター クラス名を取得します。

TypeId

この属性型の一意の ID を取得します。

メソッド

Equals(Object)

指定したオブジェクトの値が現在の EditorAttribute と等しいかどうかを示す値を返します。

GetHashCode()

このインスタンスのハッシュ コードを返します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象