DataGridViewEditingControlShowingEventArgs 类

定义

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
继承
DataGridViewEditingControlShowingEventArgs

示例

下面的代码示例演示如何处理此事件以更改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 类的新实例。Initializes a new instance of the DataGridViewEditingControlShowingEventArgs class.

属性

CellStyle

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

Control

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

方法

Equals(Object)

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

(继承自 Object)
GetHashCode()

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

(继承自 Object)
GetType()

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

(继承自 Object)
MemberwiseClone()

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

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅