DataGridViewColumnSortMode DataGridViewColumnSortMode DataGridViewColumnSortMode DataGridViewColumnSortMode Enum

定義

定義使用者要如何排序 DataGridView 資料行。Defines how a DataGridView column can be sorted by the user.

public enum class DataGridViewColumnSortMode
public enum DataGridViewColumnSortMode
type DataGridViewColumnSortMode = 
Public Enum DataGridViewColumnSortMode
繼承
DataGridViewColumnSortModeDataGridViewColumnSortModeDataGridViewColumnSortModeDataGridViewColumnSortMode

欄位

Automatic Automatic Automatic Automatic 1

使用者可以按一下資料行標頭 (或在儲存格上按 F3) 來排序資料行,除非資料行標頭用於選項中。The user can sort the column by clicking the column header (or pressing F3 on a cell) unless the column headers are used for selection. 畫面上將會自動顯示排序圖像 (Glyph)。A sorting glyph will be displayed automatically.

NotSortable NotSortable NotSortable NotSortable 0

只能以程式方式排序資料行,但是其本意並不是要排序,所以資料行行首將不會包含用於排序圖像的空格。The column can only be sorted programmatically, but it is not intended for sorting, so the column header will not include space for a sorting glyph.

Programmatic Programmatic Programmatic Programmatic 2

只能以程式方式排序資料行,而且資料行行首將會包含用於排序圖像的空格。The column can only be sorted programmatically, and the column header will include space for a sorting glyph.

範例

下列程式碼範例說明如何使用此類型。The following code example illustrates the use of this type. 如需詳細資訊,請參閱如何:設定 Windows Forms DataGridView 控制項中的資料行排序模式。For more information, see How to: Set the Sort Modes for Columns in the Windows Forms DataGridView Control.

this.dataGridView1.Columns["Priority"].SortMode =
    DataGridViewColumnSortMode.Automatic;
Me.dataGridView1.Columns("Priority").SortMode = _
    DataGridViewColumnSortMode.Automatic

備註

每個資料行可能會有不同于屬性所SortMode指定的排序模式。Each column may have a different sort mode specified by the SortMode property.

適用於

另請參閱