DataGridViewEditingControlShowingEventArgs DataGridViewEditingControlShowingEventArgs DataGridViewEditingControlShowingEventArgs DataGridViewEditingControlShowingEventArgs Class

定义

EditingControlShowing 事件提供数据。Provides data for the EditingControlShowing event.

public ref class DataGridViewEditingControlShowingEventArgs : EventArgs
public class DataGridViewEditingControlShowingEventArgs : EventArgs
type DataGridViewEditingControlShowingEventArgs = class
    inherit EventArgs
Public Class DataGridViewEditingControlShowingEventArgs
Inherits EventArgs
继承
DataGridViewEditingControlShowingEventArgsDataGridViewEditingControlShowingEventArgsDataGridViewEditingControlShowingEventArgsDataGridViewEditingControlShowingEventArgs

示例

下面的代码示例演示了如何处理此事件以更改BackColor当前单元格的属性。The following code example illustrates how to handle this event to change the BackColor property of the current cell. 若要运行此示例,请将代码粘贴到包含一个窗体DataGridView名为dataGridView1并确保EditingControlShowing事件是与事件处理程序相关联。To run this example, paste the code into a form that contains a DataGridView named dataGridView1 and ensure that the EditingControlShowing event is associated with the event handler.

private void dataGridView1_EditingControlShowing(object sender, 
    DataGridViewEditingControlShowingEventArgs e)
{
    e.CellStyle.BackColor = Color.Aquamarine;
}
Private Sub dataGridView1_EditingControlShowing(ByVal sender As Object, _
    ByVal e As DataGridViewEditingControlShowingEventArgs) _
    Handles dataGridView1.EditingControlShowing

    e.CellStyle.BackColor = Color.Aquamarine

End Sub

注解

处理EditingControlShowing事件时要执行的编辑控件的自定义初始化的单元格进入编辑模式。Handle the EditingControlShowing event to perform custom initialization of the editing control when a cell enters edit mode. 若要自定义控件的显示特性,请设置返回的对象的属性CellStyle属性,而无需设置返回的控件属性Control属性。To customize the display characteristics of the control, set the properties of the object returned by the CellStyle property rather than setting the properties of the control returned by the Control property.

有关如何处理事件的详细信息,请参阅处理和引发事件For more information about how to handle events, see Handling and Raising Events.

构造函数

DataGridViewEditingControlShowingEventArgs(Control, DataGridViewCellStyle) DataGridViewEditingControlShowingEventArgs(Control, DataGridViewCellStyle) DataGridViewEditingControlShowingEventArgs(Control, DataGridViewCellStyle) DataGridViewEditingControlShowingEventArgs(Control, DataGridViewCellStyle)

初始化 DataGridViewEditingControlShowingEventArgs 类的新实例。Initializes a new instance of the DataGridViewEditingControlShowingEventArgs class.

属性

CellStyle CellStyle CellStyle CellStyle

获取或设置已编辑单元格的单元格样式。Gets or sets the cell style of the edited cell.

Control Control Control Control

向用户显示的用于编辑选定单元格的值的控件。The control shown to the user for editing the selected cell's value.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于

另请参阅