DataGridViewEditMode DataGridViewEditMode DataGridViewEditMode DataGridViewEditMode Enum

定义

指定用户如何在 DataGridView 控件中启动单元格编辑。Specifies how a user starts cell editing in the DataGridView control.

public enum class DataGridViewEditMode
public enum DataGridViewEditMode
type DataGridViewEditMode = 
Public Enum DataGridViewEditMode
继承
DataGridViewEditModeDataGridViewEditModeDataGridViewEditModeDataGridViewEditMode

字段

EditOnEnter EditOnEnter EditOnEnter EditOnEnter 0

当单元格接收到焦点时即可开始编辑。Editing begins when the cell receives focus. 在按 Tab 键在行中横向输入值,或按 Enter 键在列中纵向输入值时,此模式非常有用。This mode is useful when pressing the TAB key to enter values across a row, or when pressing the ENTER key to enter values down a column.

EditOnF2 EditOnF2 EditOnF2 EditOnF2 3

当单元格获得焦点时按 F2 开始编辑。Editing begins when F2 is pressed while the cell has focus. 此模式将选择点放置在单元格内容的末尾。This mode places the selection point at the end of the cell contents.

EditOnKeystroke EditOnKeystroke EditOnKeystroke EditOnKeystroke 1

当单元格获得焦点时按任意字母数字键开始编辑。Editing begins when any alphanumeric key is pressed while the cell has focus.

EditOnKeystrokeOrF2 EditOnKeystrokeOrF2 EditOnKeystrokeOrF2 EditOnKeystrokeOrF2 2

当单元格获得焦点时按任意字母数字键或 F2 开始编辑。Editing begins when any alphanumeric key or F2 is pressed while the cell has focus.

EditProgrammatically EditProgrammatically EditProgrammatically EditProgrammatically 4

仅在调用 BeginEdit(Boolean) 方法时开始编辑。Editing begins only when the BeginEdit(Boolean) method is called.

示例

下面的代码示例演示如何使用此类型。The following code example illustrates the use of this type. 有关详细信息,请参阅如何:指定 Windows 窗体 DataGridView 控件的编辑模式For more information, see How to: Specify the Edit Mode for the Windows Forms DataGridView Control.

this.dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;
Me.dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter

注解

此枚举由EditMode属性的DataGridView控件。This enumeration is used by the EditMode property of the DataGridView control.

所有DataGridViewEditMode除外 EditProgrammatically 值允许用户双击单元格开始编辑它。All DataGridViewEditMode values except for EditProgrammatically allow a user to double-click a cell to begin editing it.

适用于

另请参阅