DataGridView.CurrentCellChanged Evento

Definición

Se produce cuando cambia la propiedad CurrentCell.

C#
public event EventHandler CurrentCellChanged;

Tipo de evento

EventHandler

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este evento. Este ejemplo forma parte de un ejemplo más grande disponible en How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control.

C#
// Forces the row to repaint itself when the user changes the 
// current cell. This is necessary to refresh the focus rectangle.
void dataGridView1_CurrentCellChanged(object sender, EventArgs e)
{
    if (oldRowIndex != -1)
    {
        this.dataGridView1.InvalidateRow(oldRowIndex);
    }
    oldRowIndex = this.dataGridView1.CurrentCellAddress.Y;
}

Comentarios

Para obtener más información acerca de cómo controlar eventos, vea controlar y provocar eventos.

Se aplica a

Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

Consulte también