PropertyGrid.PropertySort Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri vagy beállítja a tulajdonságok megjelenítéséhez használt adatok rendezésének PropertyGrid típusát.
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
Tulajdonság értéke
Az egyik PropertySort érték. Az alapértelmezett érték a vagy CategorizedAlphabetical.
Kivételek
A hozzárendelt érték nem tartozik az PropertySort értékek közé.
Példák
Az alábbi példakód egy vezérlő inicializálását PropertyGrid mutatja be a PropertySort, ToolbarVisible tulajdonságok használatával. Emellett ez a példa úgy állítja be a PropertyGrid vezérlő tulajdonságát Visible , hogy false a rács ne legyen látható a példa futtatásakor. A példa futtatásához illessze be a következő kódot egy űrlapba, és hívja meg a InitializePropertyGrid metódust az űrlap konstruktor- vagy Load eseménykezelési metódusából. Ha meg szeretné tekinteni a tulajdonságrácsot az űrlap futtatásakor, módosítsa a rács tulajdonságát Visibletrueújrafordításra, majd futtassa újra az űrlapot.
// 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
Megjegyzések
A tulajdonság beállításakor PropertySort a rács tulajdonságrendező gombjainak megjelenése a tulajdonság aktuális állapotának megfelelően változik. Annak beállítása PropertySort , hogy PropertySort.NoSort a tulajdonságok a lekérésük sorrendjében jelenjenek meg.
Mindkettőre van állítvaPropertySort, és Categorized ugyanaz, mint az önálló beállítás PropertySortCategorized.Alphabetical A kategorizált nézet mindig betűrendben jelenik meg.
Note
Egyéni rendezéshez implementálja ICustomTypeDescriptor az összetevőt, hogy a tulajdonságokat a kívánt sorrendben adja vissza.