XmlMappedRange.BeforeRightClick 이벤트

XmlMappedRange 컨트롤을 마우스 오른쪽 단추로 클릭할 때 기본적인 오른쪽 클릭 동작 이전에 발생합니다.

네임스페이스:  Microsoft.Office.Tools.Excel
어셈블리:  Microsoft.Office.Tools.Excel(Microsoft.Office.Tools.Excel.dll)

구문

‘선언
Event BeforeRightClick As DocEvents_BeforeRightClickEventHandler
event DocEvents_BeforeRightClickEventHandler BeforeRightClick

예제

다음 코드에서는 XmlMappedRange에서 오른쪽 클릭 동작을 취소하는 BeforeRightClick 이벤트에 대한 처리기를 보여 줍니다. 이벤트 처리기에서는 XmlMappedRange에 대해 오른쪽 클릭을 사용할 수 없음을 사용자에게 알린 다음 Microsoft Office Excel에서 오른쪽 클릭 동작이 취소되도록 DocEvents_BeforeRightClickEventHandler 이벤트 처리기의 Cancel 매개 변수를 true로 설정합니다. 이 코드 예제에서는 현재 워크시트에 CustomerLastNameCell이라는 XmlMappedRange가 포함되어 있다고 가정합니다.

Sub CustomerLastNameCell_BeforeRightClick(ByVal Target As Excel.Range, _
    ByRef Cancel As Boolean) Handles CustomerLastNameCell.BeforeRightClick
    MsgBox("Right-clicking in this range is not allowed.")
    Cancel = True
End Sub
private void XmlMappedRange_BeforeRightClick()
{
    this.CustomerLastNameCell.BeforeRightClick += 
        new Excel.DocEvents_BeforeRightClickEventHandler(
        CustomerLastNameCell_BeforeRightClick);
}

void CustomerLastNameCell_BeforeRightClick(Excel.Range Target, 
    ref bool Cancel)
{
    MessageBox.Show("Right-clicking in this range " +
        " is not allowed.");
    Cancel = true;
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

XmlMappedRange 인터페이스

Microsoft.Office.Tools.Excel 네임스페이스