DesignerCategoryAttribute 클래스

정의

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

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

예제

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

[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

다음 예제에서는 의 instance 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 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 = 
       (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
구성 요소 구성 요소와 함께 사용되는 디자이너입니다. 특성이 상수 멤버 DesignerCategoryAttribute.Component로 설정됩니다.
Form 양식에 사용되는 디자이너입니다. 특성이 상수 멤버 DesignerCategoryAttribute.Form로 설정됩니다.
Designer 디자이너와 함께 사용되는 디자이너입니다. 특성이 상수 멤버 DesignerCategoryAttribute.Generic로 설정됩니다.
빈 문자열("") 기본 범주입니다.

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

생성자

DesignerCategoryAttribute()

빈 문자열("")로 DesignerCategoryAttribute 클래스의 새 인스턴스를 초기화합니다.

DesignerCategoryAttribute(String)

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

필드

Component

이 범주로 표시된 구성 요소에서 구성 요소 디자이너를 사용함을 지정합니다. 이 필드는 읽기 전용입니다.

Default

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

Form

이 범주로 표시된 구성 요소에서 폼 디자이너를 사용함을 지정합니다. 이 static 필드는 읽기 전용입니다.

Generic

이 범주로 표시된 구성 요소에서 일반 디자이너를 사용함을 지정합니다. 이 static 필드는 읽기 전용입니다.

속성

Category

범주 이름을 가져옵니다.

TypeId

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

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

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

GetHashCode()

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

GetType()

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

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

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

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)

적용 대상

추가 정보