DataGridViewSelectionMode 列舉

定義

描述要如何選取 DataGridView 控制項的儲存格。Describes how cells of a DataGridView control can be selected.

public enum class DataGridViewSelectionMode
public enum DataGridViewSelectionMode
type DataGridViewSelectionMode = 
Public Enum DataGridViewSelectionMode
繼承
DataGridViewSelectionMode

欄位

CellSelect 0

可以選取一或多個儲存格。One or more individual cells can be selected.

ColumnHeaderSelect 4

可以按一下資料行行首儲存格來選取資料行。The column will be selected by clicking in the column's header cell. 可以按一下個別儲存格來選取該儲存格。An individual cell can be selected by clicking that cell.

FullColumnSelect 2

可以按一下資料行行首或是包含在該資料行中的儲存格來選取整個資料行。The entire column will be selected by clicking the column's header or a cell contained in that column.

FullRowSelect 1

可以按一下資料列行首或是包含在該資料列中的儲存格來選取整個資料列。The entire row will be selected by clicking its row's header or a cell contained in that row.

RowHeaderSelect 3

可以按一下資料列行首儲存格來選取資料列。The row will be selected by clicking in the row's header cell. 可以按一下個別儲存格來選取該儲存格。An individual cell can be selected by clicking that cell.

範例

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

this.dataGridView1.SelectionMode =
    DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.MultiSelect = false;
With Me.dataGridView1
    .SelectionMode = DataGridViewSelectionMode.FullRowSelect
    .MultiSelect = False
End With

備註

這個列舉是用來設定 SelectionMode 控制項的屬性 DataGridViewThis enumeration is used to set the SelectionMode property of a DataGridView control.

適用於

另請參閱