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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「EditorAttribute クラス」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS