DesignerActionList.GetSortedActionItems 메서드

정의

이 목록에 포함된 DesignerActionItem 개체의 컬렉션을 반환합니다.

public:
 virtual System::ComponentModel::Design::DesignerActionItemCollection ^ GetSortedActionItems();
public virtual System.ComponentModel.Design.DesignerActionItemCollection GetSortedActionItems ();
abstract member GetSortedActionItems : unit -> System.ComponentModel.Design.DesignerActionItemCollection
override this.GetSortedActionItems : unit -> System.ComponentModel.Design.DesignerActionItemCollection
Public Overridable Function GetSortedActionItems () As DesignerActionItemCollection

반환

이 목록의 항목을 포함하는 DesignerActionItem 배열입니다.

예제

다음 코드 예제에는 컬렉션을 만드는 방법을 보여 줍니다 DesignerActionItem 개체입니다.

이 코드 예제에 대한 전체 설명은 방법: Windows Forms 구성 요소에 스마트 태그 연결을 참조하세요.

public override DesignerActionItemCollection GetSortedActionItems()
{
    DesignerActionItemCollection items = new DesignerActionItemCollection();

    //Define static section header entries.
    items.Add(new DesignerActionHeaderItem("Appearance"));
    items.Add(new DesignerActionHeaderItem("Information"));

    //Boolean property for locking color selections.
    items.Add(new DesignerActionPropertyItem("LockColors",
                     "Lock Colors", "Appearance",
                     "Locks the color properties."));
    if (!LockColors)
    {
        items.Add(new DesignerActionPropertyItem("BackColor",
                         "Back Color", "Appearance",
                         "Selects the background color."));
        items.Add(new DesignerActionPropertyItem("ForeColor",
                         "Fore Color", "Appearance",
                         "Selects the foreground color."));

        //This next method item is also added to the context menu 
        // (as a designer verb).
        items.Add(new DesignerActionMethodItem(this,
                         "InvertColors", "Invert Colors",
                         "Appearance",
                         "Inverts the fore and background colors.",
                          true));
    }
    items.Add(new DesignerActionPropertyItem("Text",
                     "Text String", "Appearance",
                     "Sets the display text."));

    //Create entries for static Information section.
    StringBuilder location = new StringBuilder("Location: ");
    location.Append(colLabel.Location);
    StringBuilder size = new StringBuilder("Size: ");
    size.Append(colLabel.Size);
    items.Add(new DesignerActionTextItem(location.ToString(),
                     "Information"));
    items.Add(new DesignerActionTextItem(size.ToString(),
                     "Information"));

    return items;
}
Public Overrides Function GetSortedActionItems() _
As DesignerActionItemCollection
    Dim items As New DesignerActionItemCollection()

    'Define static section header entries.
    items.Add(New DesignerActionHeaderItem("Appearance"))
    items.Add(New DesignerActionHeaderItem("Information"))

    'Boolean property for locking color selections.
    items.Add(New DesignerActionPropertyItem( _
    "LockColors", _
    "Lock Colors", _
    "Appearance", _
    "Locks the color properties."))

    If Not LockColors Then
        items.Add( _
        New DesignerActionPropertyItem( _
        "BackColor", _
        "Back Color", _
        "Appearance", _
        "Selects the background color."))

        items.Add( _
        New DesignerActionPropertyItem( _
        "ForeColor", _
        "Fore Color", _
        "Appearance", _
        "Selects the foreground color."))

        'This next method item is also added to the context menu 
        ' (as a designer verb).
        items.Add( _
        New DesignerActionMethodItem( _
        Me, _
        "InvertColors", _
        "Invert Colors", _
        "Appearance", _
        "Inverts the fore and background colors.", _
        True))
    End If
    items.Add( _
    New DesignerActionPropertyItem( _
    "Text", _
    "Text String", _
    "Appearance", _
    "Sets the display text."))

    'Create entries for static Information section.
    Dim location As New StringBuilder("Location: ")
    location.Append(colLabel.Location)
    Dim size As New StringBuilder("Size: ")
    size.Append(colLabel.Size)

    items.Add( _
    New DesignerActionTextItem( _
    location.ToString(), _
    "Information"))

    items.Add( _
    New DesignerActionTextItem( _
    size.ToString(), _
    "Information"))

    Return items
End Function

설명

메서드는 virtualGetSortedActionItems 클래스에서 DesignerActionItem 파생된 개체의 컬렉션을 예상 표시 순서로 반환하도록 구현됩니다. 이러한 항목은 다음과 같은 특정 형식일 수 있습니다.

Type Description
DesignerActionHeaderItem 굵게 표시된 그룹 레이블입니다.
DesignerActionTextItem 일반 글꼴로 표시되는 레이블입니다.
DesignerActionPropertyItem 속성과 연결된 패널 항목입니다. 기본 속성과 연결된 검사 표시 또는 속성 편집기를 표시할 수도 있습니다.
DesignerActionMethodItem 하이퍼링크로 표시되고 메서드와 연결된 패널 항목입니다.

모든 DesignerActionMethodItemDesignerActionPropertyItem의 경우 해당 메서드 또는 속성을 클래스에서 파생된 프로그래머 제공 클래스에 DesignerActionList 추가해야 합니다. 각 메서드 및 속성 항목이 활성 항목으로 표시됩니다. UI(사용자 인터페이스)를 통해 상호 작용하면 해당 메서드 또는 속성이 각각 호출됩니다.

속성 항목에는 해당 속성 값을 표시하고 조작할 수 있는 특수 패널 항목 인터페이스가 있습니다. 자세한 내용은 DesignerActionPropertyItem 클래스를 참조하세요.

반환된 배열의 항목 순서는 패널에 표시되는 순서를 반영합니다. 항목은 다음 규칙을 사용하여 속성에 Category 따라 그룹화됩니다.

  • 발생한 첫 번째 항목의 범주는 첫 번째 그룹의 시작을 의미합니다. 해당 그룹은 성공하는 각 항목이 동일한 범주인 한 계속됩니다. 다른 새 범주의 항목이 발견되면 새 그룹이 만들어지고 항목이 해당 범주에 배치됩니다.

  • 항목에 현재 그룹과 다른 형식이 있지만 해당 범주가 이미 사용된 경우 항목은 일치하는 기존 범주에 배치됩니다.

  • 항목에 범주가 없으면 패널 끝에 있는 기타 그룹에 배치됩니다. 이 그룹에는 속성이 로 AllowAssociate 설정된 false항목도 포함됩니다.

패널을 GetSortedActionItems 처음 만들 때 메서드가 호출됩니다. 패널에 Refresh 표시된 항목 목록을 업데이트하려면 메서드를 호출해야 합니다.

적용 대상

추가 정보