PropertyGrid.PropertySort 속성

정의

속성을 표시하기 위해 사용하는 PropertyGrid의 정렬 형식을 가져오거나 설정합니다.

public:
 property System::Windows::Forms::PropertySort PropertySort { System::Windows::Forms::PropertySort get(); void set(System::Windows::Forms::PropertySort value); };
public System.Windows.Forms.PropertySort PropertySort { get; set; }
member this.PropertySort : System.Windows.Forms.PropertySort with get, set
Public Property PropertySort As PropertySort

속성 값

PropertySort 값 중 하나입니다. 기본값은 Categorized 또는 Alphabetical입니다.

예외

할당된 값이 PropertySort 값 중 하나가 아닌 경우

예제

다음 코드 예제에서는 를 사용 하 여 컨트롤을 PropertyGrid 초기화 하는 방법을 보여 줍니다는 PropertySortToolbarVisible 속성입니다. 또한 이 예제에서는 컨트롤의 Visible 속성을 로 false 설정 PropertyGrid 하여 예제를 실행할 때 그리드가 표시되지 않도록 합니다. 이 예제를 실행하려면 폼에 다음 코드를 붙여넣고 폼의 생성자 또는 Load 이벤트 처리 메서드에서 메서드를 호출 InitializePropertyGrid 합니다. 폼이 실행 중일 때 속성 표를 보려면 그리드의 Visible 속성을 로 true변경하고 양식을 다시 컴파일하고 다시 실행합니다.

   // Declare a propertyGrid.
internal:
   PropertyGrid^ propertyGrid1;

private:

   // Initialize propertyGrid1.
   [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")]
   void InitializePropertyGrid()
   {
      propertyGrid1 = gcnew PropertyGrid;
      propertyGrid1->Name = "PropertyGrid1";
      propertyGrid1->Location = System::Drawing::Point( 185, 20 );
      propertyGrid1->Size = System::Drawing::Size( 150, 300 );
      propertyGrid1->TabIndex = 5;
      
      // Set the sort to alphabetical and set Toolbar visible
      // to false, so the user cannot change the sort.
      propertyGrid1->PropertySort = PropertySort::Alphabetical;
      propertyGrid1->ToolbarVisible = false;
      propertyGrid1->Text = "Property Grid";
      
      // Add the PropertyGrid to the form, but set its
      // visibility to False so it will not appear when the form loads.
      propertyGrid1->Visible = false;
      this->Controls->Add( propertyGrid1 );
   }

// Declare a propertyGrid.
internal PropertyGrid propertyGrid1;

// Initialize propertyGrid1.
private void InitializePropertyGrid()
{
    propertyGrid1 = new PropertyGrid();
    propertyGrid1.Name = "PropertyGrid1";
    propertyGrid1.Location = new System.Drawing.Point(185, 20);
    propertyGrid1.Size = new System.Drawing.Size(150, 300);
    propertyGrid1.TabIndex = 5;

    // Set the sort to alphabetical and set Toolbar visible
    // to false, so the user cannot change the sort.
    propertyGrid1.PropertySort = PropertySort.Alphabetical;
    propertyGrid1.ToolbarVisible = false;
    propertyGrid1.Text = "Property Grid";

    // Add the PropertyGrid to the form, but set its
    // visibility to False so it will not appear when the form loads.
    propertyGrid1.Visible = false;
    this.Controls.Add(propertyGrid1);
}

'Declare a propertyGrid.
Friend WithEvents propertyGrid1 As PropertyGrid

'Initialize propertyGrid1.
Private Sub InitializePropertyGrid()
    propertyGrid1 = New PropertyGrid
    propertyGrid1.Name = "PropertyGrid1"
    propertyGrid1.Location = New Point(185, 20)
    propertyGrid1.Size = New System.Drawing.Size(150, 300)
    propertyGrid1.TabIndex = 5

    'Set the sort to alphabetical and set Toolbar visible
    'to false, so the user cannot change the sort.
    propertyGrid1.PropertySort = PropertySort.Alphabetical
    propertyGrid1.ToolbarVisible = False
    propertyGrid1.Text = "Property Grid"

    ' Add the PropertyGrid to the form, but set its
    ' visibility to False so it will not appear when the form loads.
    propertyGrid1.Visible = False
    Me.Controls.Add(propertyGrid1)

End Sub

설명

속성을 설정 PropertySort 하면 그리드의 속성 정렬 단추 모양이 속성의 현재 상태를 반영하도록 변경됩니다. 를 로 PropertySort.NoSort 설정 PropertySort 하면 속성이 검색된 순서대로 표시됩니다.

Categorized 를 둘 다 Alphabetical 로 설정하는 PropertySort 것은 를 단독으로 설정하는 CategorizedPropertySort 것과 같습니다. 분류된 뷰는 항상 사전순으로 표시됩니다.

참고

사용자 지정 정렬을 수행하려면 구성 요소에서 를 구현 ICustomTypeDescriptor 하여 원하는 순서로 속성을 반환합니다.

적용 대상