DataGridViewCell.OnMouseLeave(Int32) Método

Definição

Chamado quando o ponteiro do mouse deixa a célula.

protected:
 virtual void OnMouseLeave(int rowIndex);
protected virtual void OnMouseLeave (int rowIndex);
abstract member OnMouseLeave : int -> unit
override this.OnMouseLeave : int -> unit
Protected Overridable Sub OnMouseLeave (rowIndex As Integer)

Parâmetros

rowIndex
Int32

O índice da linha pai da célula.

Exemplos

O exemplo de código a seguir ilustra o uso desse método. Este exemplo faz parte de um exemplo maior disponível em Como personalizar células e colunas no controle Windows Forms DataGridView estendendo seu comportamento e aparência.

// Force the cell to repaint itself when the mouse pointer enters it.
protected override void OnMouseEnter(int rowIndex)
{
    this.DataGridView.InvalidateCell(this);
}

// Force the cell to repaint itself when the mouse pointer leaves it.
protected override void OnMouseLeave(int rowIndex)
{
    this.DataGridView.InvalidateCell(this);
}
' Force the cell to repaint itself when the mouse pointer enters it.
Protected Overrides Sub OnMouseEnter(ByVal rowIndex As Integer)
    Me.DataGridView.InvalidateCell(Me)
End Sub

' Force the cell to repaint itself when the mouse pointer leaves it.
Protected Overrides Sub OnMouseLeave(ByVal rowIndex As Integer)
    Me.DataGridView.InvalidateCell(Me)
End Sub

Comentários

Esse método é semelhante ao DataGridView.OnCellMouseLeave método . Ele é chamado nas mesmas circunstâncias em que um DataGridView.CellMouseLeave evento é acionado, mas não gera o evento.

Aplica-se a

Confira também