DataGridViewCell.OnMouseLeave(Int32) Метод

Определение

Вызывается, когда указатель мыши покидает ячейку.

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)

Параметры

rowIndex
Int32

Индекс родительской строки ячейки.

Примеры

В следующем примере кода показано использование этого метода. Этот пример является частью более крупного примера, доступного в разделе Практическое руководство. Настройка ячеек и столбцов в элементе управления Windows Forms DataGridView путем расширения их поведения и внешнего вида.

// 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

Комментарии

Этот метод аналогичен методу DataGridView.OnCellMouseLeave . Он вызывается в том же случае, DataGridView.CellMouseLeave когда возникает событие, но на самом деле событие не вызывается.

Применяется к

См. также раздел