EditorAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
プロパティの変更に使用するエディターを指定します。 このクラスは継承できません。
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
- 継承
- 属性
例
次のコード例では、 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();
// 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) |