CategoryAttribute 클래스

정의

항목별 모드로 설정된 PropertyGrid 컨트롤에 표시될 때 속성이나 이벤트를 그룹화할 범주 이름을 지정합니다.

public ref class CategoryAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.All)]
public class CategoryAttribute : Attribute
public class CategoryAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.All)>]
type CategoryAttribute = class
    inherit Attribute
type CategoryAttribute = class
    inherit Attribute
Public Class CategoryAttribute
Inherits Attribute
상속
CategoryAttribute
특성

예제

다음 예제에서는 속성을 만듭니다 MyImage . 속성에는 및 의 두 가지 특성이 DescriptionAttribute 있습니다 CategoryAttribute.

   [Description("The image associated with the control"),Category("Appearance")]
   System::Drawing::Image^ get()
   {
      // Insert code here.
      return m_Image1;
   }

   void set( System::Drawing::Image^ )
   {
      // Insert code here.
   }
}
[Description("The image associated with the control"),Category("Appearance")] 
 public Image MyImage {
    get {
       // Insert code here.
       return image1;
    }
    set {
       // Insert code here.
    }
 }
<Description("The image associated with the control"), _
    Category("Appearance")> _
Public Property MyImage() As Image
    
    Get
        ' Insert code here.
        Return image1
    End Get
    Set
        ' Insert code here.
    End Set 
End Property

다음 예제에서는 의 범주를 MyImage가져옵니다. 먼저 코드는 개체에 대한 모든 속성을 가진 을 가져옵니다 PropertyDescriptorCollection . 다음으로 코드는 를 인 PropertyDescriptorCollection 덱싱하여 를 가져옵니다 MyImage. 그런 다음 이 속성의 특성을 반환하고 변수 attributes에 저장합니다.

그런 다음, 이 예제에서는 에서 AttributeCollection검색하여 CategoryAttribute 콘솔 화면에 작성하여 범주를 인쇄합니다.

// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyImage" ]->Attributes;

// Prints the description by retrieving the CategoryAttribute.
// from the AttributeCollection.
CategoryAttribute^ myAttribute = static_cast<CategoryAttribute^>(attributes[ CategoryAttribute::typeid ]);
Console::WriteLine( myAttribute->Category );
// Gets the attributes for the property.
 AttributeCollection attributes = 
    TypeDescriptor.GetProperties(this)["MyImage"].Attributes;
 
 // Prints the description by retrieving the CategoryAttribute.
 // from the AttributeCollection.
 CategoryAttribute myAttribute = 
    (CategoryAttribute)attributes[typeof(CategoryAttribute)];
 Console.WriteLine(myAttribute.Category);
' Gets the attributes for the property.
Dim attributes As AttributeCollection = _
    TypeDescriptor.GetProperties(Me)("MyImage").Attributes

' Prints the description by retrieving the CategoryAttribute. 
' from the AttributeCollection.
Dim myAttribute As CategoryAttribute = _
    CType(attributes(GetType(CategoryAttribute)), CategoryAttribute)
    Console.WriteLine(myAttribute.Category)

설명

CategoryAttribute 컨트롤이 모드로 설정된 속성 또는 이벤트를 나열할 때 연결된 속성 또는 이벤트를 연결할 범주를 PropertyGridCategorized 나타냅니다. 가 CategoryAttribute 속성 또는 이벤트에 적용되지 않은 경우 은 PropertyGridMisc 범주에 연결합니다. 에 대한 생성자에서 범주의 이름을 지정하여 모든 이름에 대해 새 범주를 CategoryAttribute만들 수 있습니다.

속성은 Category 특성이 나타내는 범주의 이름을 나타냅니다. 속성은 Category 범주 이름의 투명한 지역화도 제공합니다.

상속자 참고

미리 정의된 이름 이외의 범주 이름을 사용하고 범주 이름을 지역화하려는 경우 메서드를 재정의 GetLocalizedString(String) 해야 합니다.

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

범주 설명
Action 사용 가능한 작업과 관련된 속성입니다.
Appearance 엔터티가 표시되는 방식과 관련된 속성입니다.
Behavior 엔터티의 작동 방식과 관련된 속성입니다.
Data 데이터 및 데이터 원본 관리와 관련된 속성입니다.
Default 기본 범주에 그룹화된 속성입니다.
Design 디자인 타임에만 사용할 수 있는 속성입니다.
DragDrop 끌어서 놓기 작업과 관련된 속성입니다.
Focus 포커스와 관련된 속성입니다.
Format 서식 지정과 관련된 속성입니다.
Key 키보드와 관련된 속성입니다.
Layout 레이아웃과 관련된 속성입니다.
Mouse 마우스와 관련된 속성입니다.
WindowStyle 최상위 폼의 창 스타일과 관련된 속성입니다.

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

생성자

CategoryAttribute()

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

CategoryAttribute(String)

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

속성

Action

작업 범주를 나타내는 CategoryAttribute를 가져옵니다.

Appearance

모양 범주를 나타내는 CategoryAttribute를 가져옵니다.

Asynchronous

비동기 범주를 나타내는 CategoryAttribute를 가져옵니다.

Behavior

동작 범주를 나타내는 CategoryAttribute를 가져옵니다.

Category

이 특성이 적용되는 속성 또는 이벤트의 범주 이름을 가져옵니다.

Data

데이터 범주를 나타내는 CategoryAttribute를 가져옵니다.

Default

기본 범주를 나타내는 CategoryAttribute를 가져옵니다.

Design

디자인 범주를 나타내는 CategoryAttribute를 가져옵니다.

DragDrop

끌어서 놓기 범주를 나타내는 CategoryAttribute를 가져옵니다.

Focus

포커스 범주를 나타내는 CategoryAttribute를 가져옵니다.

Format

형식 범주를 나타내는 CategoryAttribute를 가져옵니다.

Key

키 범주를 나타내는 CategoryAttribute를 가져옵니다.

Layout

레이아웃 범주를 나타내는 CategoryAttribute를 가져옵니다.

Mouse

마우스 범주를 나타내는 CategoryAttribute를 가져옵니다.

TypeId

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

(다음에서 상속됨 Attribute)
WindowStyle

창 스타일 범주를 나타내는 CategoryAttribute를 가져옵니다.

메서드

Equals(Object)

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

GetHashCode()

해당 특성의 해시 코드를 반환합니다.

GetLocalizedString(String)

지정된 범주의 지역화 이름을 찾습니다.

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)

적용 대상

추가 정보