DataGridViewCell.OnMouseClick(DataGridViewCellMouseEventArgs) 메서드

정의

포인터가 셀에 있는 동안 마우스 단추를 클릭하면 호출됩니다.

protected:
 virtual void OnMouseClick(System::Windows::Forms::DataGridViewCellMouseEventArgs ^ e);
protected virtual void OnMouseClick (System.Windows.Forms.DataGridViewCellMouseEventArgs e);
abstract member OnMouseClick : System.Windows.Forms.DataGridViewCellMouseEventArgs -> unit
override this.OnMouseClick : System.Windows.Forms.DataGridViewCellMouseEventArgs -> unit
Protected Overridable Sub OnMouseClick (e As DataGridViewCellMouseEventArgs)

매개 변수

e
DataGridViewCellMouseEventArgs

이벤트 데이터를 포함하는 DataGridViewCellMouseEventArgs입니다.

예제

다음 코드 예제에서는이 메서드를 사용 하는 방법을 보여 줍니다.

// Override OnMouseClick in a class derived from DataGridViewCell to 
// enter edit mode when the user clicks the cell. 
protected override void OnMouseClick(DataGridViewCellMouseEventArgs e)
{
    if (base.DataGridView != null)
    {
        Point point1 = base.DataGridView.CurrentCellAddress;
        if (point1.X == e.ColumnIndex &&
            point1.Y == e.RowIndex &&
            e.Button == MouseButtons.Left &&
            base.DataGridView.EditMode !=
            DataGridViewEditMode.EditProgrammatically)
        {
            base.DataGridView.BeginEdit(true);
        }
    }
}
' Override OnMouseClick in a class derived from DataGridViewCell to 
' enter edit mode when the user clicks the cell. 
Protected Overrides Sub OnMouseClick( _
    ByVal e As DataGridViewCellMouseEventArgs)

    If MyBase.DataGridView IsNot Nothing Then

        Dim point1 As Point = MyBase.DataGridView.CurrentCellAddress
        If point1.X = e.ColumnIndex And _
            point1.Y = e.RowIndex And _
            e.Button = MouseButtons.Left And _
            Not MyBase.DataGridView.EditMode = _
            DataGridViewEditMode.EditProgrammatically Then

            MyBase.DataGridView.BeginEdit(True)

        End If
    End If
End Sub

설명

이 메서드는 비슷합니다는 DataGridView.OnCellMouseClick 메서드. 동일한 상황에서 호출 되는 DataGridView.CellMouseClick 이벤트가 발생 하지만 실제로 이벤트가 발생 하지 않습니다.

적용 대상

추가 정보