DataGridViewSelectionMode DataGridViewSelectionMode DataGridViewSelectionMode DataGridViewSelectionMode Enum

定义

描述可以如何选定 DataGridView 控件的单元格。Describes how cells of a DataGridView control can be selected.

public enum class DataGridViewSelectionMode
public enum DataGridViewSelectionMode
type DataGridViewSelectionMode = 
Public Enum DataGridViewSelectionMode
继承
DataGridViewSelectionModeDataGridViewSelectionModeDataGridViewSelectionModeDataGridViewSelectionMode

字段

CellSelect CellSelect CellSelect CellSelect 0

可以选定一个或多个单元格。One or more individual cells can be selected.

ColumnHeaderSelect ColumnHeaderSelect ColumnHeaderSelect 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 FullColumnSelect FullColumnSelect FullColumnSelect 2

通过单击列的标头或该列所包含的单元格选定整个列。The entire column will be selected by clicking the column's header or a cell contained in that column.

FullRowSelect FullRowSelect FullRowSelect FullRowSelect 1

通过单击行的标头或是该行所包含的单元格选定整个行。The entire row will be selected by clicking its row's header or a cell contained in that row.

RowHeaderSelect RowHeaderSelect RowHeaderSelect 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 窗体 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属性的DataGridView控件。This enumeration is used to set the SelectionMode property of a DataGridView control.

适用于

另请参阅