DesignerCategoryAttribute 클래스

정의

클래스의 디자이너가 특정 범주에 속하도록 지정합니다.

public ref class DesignerCategoryAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class DesignerCategoryAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
type DesignerCategoryAttribute = class
    inherit Attribute
Public NotInheritable Class DesignerCategoryAttribute
Inherits Attribute
상속
DesignerCategoryAttribute
특성

예제

다음 예제에서는 라는 MyForm클래스를 만듭니다. MyForm에는 이 클래스를 DesignerAttribute 사용하는 두 가지 특성과 DocumentDesigner 범주를 DesignerCategoryAttribute지정 Form 하는 특성이 있습니다.

[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design",
IRootDesigner::typeid),
DesignerCategory("Form")]
ref class MyForm: public ContainerControl{
   // Insert code here.
};
[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design",
    typeof(IRootDesigner)),
    DesignerCategory("Form")]

public class MyForm : ContainerControl
{
    // Insert code here.
}
<Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design", _
    GetType(IRootDesigner)), DesignerCategory("Form")> _
Public Class MyForm
    
    Inherits ContainerControl
    ' Insert code here.
End Class

다음 예제에서는 .의 MyForm인스턴스를 만듭니다. 그런 다음 클래스의 특성을 가져오고, 추출 DesignerCategoryAttribute하고, 디자이너의 이름을 출력합니다.

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 
       * DesignerCategoryAttribute from the AttributeCollection. */
   DesignerCategoryAttribute^ myAttribute = dynamic_cast<DesignerCategoryAttribute^>(attributes[ DesignerCategoryAttribute::typeid ]);
   Console::WriteLine( "The category of the designer for this class is: {0}", myAttribute->Category );
   return 0;
}
public static int Main()
{
    // Creates a new form.
    MyForm myNewForm = new();

    // Gets the attributes for the collection.
    AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewForm);

    /* Prints the name of the designer by retrieving the 
     * DesignerCategoryAttribute from the AttributeCollection. */
    DesignerCategoryAttribute myAttribute =
       (DesignerCategoryAttribute)attributes[typeof(DesignerCategoryAttribute)];
    Console.WriteLine("The category of the designer for this class is: " + myAttribute.Category);

    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
    ' DesignerCategoryAttribute from the AttributeCollection. 
    Dim myAttribute As DesignerCategoryAttribute = _
        CType(attributes(GetType(DesignerCategoryAttribute)), DesignerCategoryAttribute)
    Console.WriteLine(("The category of the designer for this class is: " + myAttribute.Category))
    Return 0
End Function 'Main

설명

비주얼 디자이너는 디자이너 범주를 사용하여 구현될 디자이너 유형의 개발 환경에 알릴 수 있습니다. 클래스에 디자이너 범주가 제공되지 않으면 개발 환경에서 클래스를 설계할 수 있거나 허용하지 않을 수 있습니다. 모든 이름에 대해 범주를 만들 수 있습니다.

이 특성으로 클래스를 표시하면 상수 멤버로 설정됩니다. 코드에서 이 특성의 값을 확인하려면 상수 멤버를 지정해야 합니다. 아래 표의 설명 열에는 각 값이 설정된 상수 멤버가 나열되어 있습니다.

클래스는 DesignerCategoryAttribute 다음과 같은 일반적인 범주를 정의합니다.

카테고리 Description
Component 구성 요소와 함께 사용되는 디자이너입니다. 특성이 상수 멤버 DesignerCategoryAttribute.Component로 설정됩니다.
Form 양식에 사용되는 디자이너입니다. 특성이 상수 멤버 DesignerCategoryAttribute.Form로 설정됩니다.
Designer 디자이너와 함께 사용되는 디자이너입니다. 특성이 상수 멤버 DesignerCategoryAttribute.Generic로 설정됩니다.
빈 문자열("") 기본 범주입니다.

자세한 내용은 특성을 참조하세요.

생성자

Name Description
DesignerCategoryAttribute()

빈 문자열("")을 사용하여 클래스의 DesignerCategoryAttribute 새 인스턴스를 초기화합니다.

DesignerCategoryAttribute(String)

지정된 범주 이름을 사용하여 클래스의 DesignerCategoryAttribute 새 인스턴스를 초기화합니다.

필드

Name Description
Component

이 범주로 표시된 구성 요소가 구성 요소 디자이너를 사용하도록 지정합니다. 이 필드는 읽기 전용입니다.

Default

이 범주로 표시된 구성 요소에서 비주얼 디자이너를 사용할 수 없게 지정합니다. 이 static 필드는 읽기 전용입니다.

Form

이 범주로 표시된 구성 요소가 양식 디자이너를 사용하도록 지정합니다. 이 static 필드는 읽기 전용입니다.

Generic

이 범주로 표시된 구성 요소가 제네릭 디자이너를 사용하도록 지정합니다. 이 static 필드는 읽기 전용입니다.

속성

Name Description
Category

범주의 이름을 가져옵니다.

TypeId

이 특성에 대한 고유 식별자를 가져옵니다.

메서드

Name Description
Equals(Object)

지정된 개체의 값이 현재 DesignOnlyAttribute개체와 같은지 여부를 반환합니다.

GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

이 특성이 기본값인지 여부를 확인합니다.

Match(Object)

파생 클래스에서 재정의되는 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

Name Description
_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)

적용 대상

추가 정보