DataGridViewCell.OnMouseLeave(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當滑鼠指標離開儲存格時呼叫。
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
儲存格的父資料列索引。
範例
下列程式碼範例說明此方法的使用方式。 此範例是如何:擴充其行為和外觀,以自訂 dataGridView 控制項中Windows Forms儲存格和資料行中較大型範例的一部分。
// 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 呼叫,但實際上不會引發事件。
適用於
另請參閱
- DataGridView
- OnCellMouseLeave(DataGridViewCellEventArgs)
- CellMouseLeave
- OnMouseClick(DataGridViewCellMouseEventArgs)
- OnMouseDoubleClick(DataGridViewCellMouseEventArgs)
- OnMouseDown(DataGridViewCellMouseEventArgs)
- OnMouseEnter(Int32)
- MouseLeaveUnsharesRow(Int32)
- OnMouseMove(DataGridViewCellMouseEventArgs)
- OnMouseUp(DataGridViewCellMouseEventArgs)