DesignerAttribute クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コンポーネントのデザイン時サービスを実装するために使用されるクラスを指定します。
public ref class DesignerAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)]
public sealed class DesignerAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)>]
type DesignerAttribute = class
inherit Attribute
Public NotInheritable Class DesignerAttribute
Inherits Attribute
- 継承
- 属性
次の例では、 という MyForm
クラスを作成します。
MyForm
には 2 つの属性 DesignerAttribute があります。このクラスを指定する は を DocumentDesigner使用し、カテゴリを指定する は DesignerCategoryAttribute を Form 使用します。
[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design.DLL",
IRootDesigner::typeid),
DesignerCategory("Form")]
ref class MyForm: public ContainerControl{
// Insert code here.
};
[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design.DLL",
typeof(IRootDesigner)),
DesignerCategory("Form")]
public class MyForm : ContainerControl {
// Insert code here.
}
<Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design.DLL", _
GetType(IRootDesigner)), DesignerCategory("Form")> _
Public Class MyForm
Inherits ContainerControl
' Insert code here.
End Class
次の例では、 の MyForm
インスタンスを作成します。 次に、 クラスの属性を取得し、 を DesignerAttribute抽出し、デザイナーの名前を出力します。
int main()
{
// Creates a new form.
MyForm^ myNewForm = gcnew MyForm;
// Gets the attributes for the collection.
AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewForm );
/* Prints the name of the designer by retrieving the DesignerAttribute
* from the AttributeCollection. */
DesignerAttribute^ myAttribute = dynamic_cast<DesignerAttribute^>(attributes[ DesignerAttribute::typeid ]);
Console::WriteLine( "The designer for this class is: {0}", myAttribute->DesignerTypeName );
return 0;
}
public static int Main() {
// Creates a new form.
MyForm myNewForm = new MyForm();
// Gets the attributes for the collection.
AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewForm);
/* Prints the name of the designer by retrieving the DesignerAttribute
* from the AttributeCollection. */
DesignerAttribute myAttribute =
(DesignerAttribute)attributes[typeof(DesignerAttribute)];
Console.WriteLine("The designer for this class is: " + myAttribute.DesignerTypeName);
return 0;
}
Public Shared Function Main() As Integer
' Creates a new form.
Dim myNewForm As New MyForm()
' Gets the attributes for the collection.
Dim attributes As AttributeCollection = TypeDescriptor.GetAttributes(myNewForm)
' Prints the name of the designer by retrieving the DesignerAttribute
' from the AttributeCollection.
Dim myAttribute As DesignerAttribute = _
CType(attributes(GetType(DesignerAttribute)), DesignerAttribute)
Console.WriteLine(("The designer for this class is: " & myAttribute.DesignerTypeName))
Return 0
End Function 'Main
デザイン時サービスに使用するクラスは、 インターフェイスを実装する IDesigner 必要があります。
デザイナーの DesignerBaseTypeName 基本型を検索するには、 プロパティを使用します。 プロパティを DesignerTypeName 使用して、このメンバーに関連付けられているデザイナーの種類の名前を取得します。
詳細については、「属性」を参照してください。
Designer |
デザイン時サービスを提供する型の名前を指定して、DesignerAttribute クラスの新しいインスタンスを初期化します。 |
Designer |
デザイナーの型とデザイナーの基本クラスを指定して、DesignerAttribute クラスの新しいインスタンスを初期化します。 |
Designer |
デザイナー クラスの名前とデザイナーの基本クラスを指定して、DesignerAttribute クラスの新しいインスタンスを初期化します。 |
Designer |
デザイン時サービスを提供する型を指定して、DesignerAttribute クラスの新しいインスタンスを初期化します。 |
Designer |
デザイナーの型とデザイナー基本クラスを指定して、DesignerAttribute クラスの新しいインスタンスを初期化します。 |
Designer |
このデザイナーの基本型の名前を取得します。 |
Designer |
このデザイナー属性と関連付けられているデザイナー型の名前を取得します。 |
Type |
この属性型の一意の ID を取得します。 |
Equals(Object) |
指定したオブジェクトの値が現在の DesignerAttribute と等しいかどうかを示す値を返します。 |
Get |
このインスタンスのハッシュ コードを返します。 |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Is |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (継承元 Attribute) |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
_Attribute. |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
_Attribute. |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (継承元 Attribute) |
_Attribute. |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
_Attribute. |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (継承元 Attribute) |
製品 | バージョン |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。