XmlMappedRange.BeforeRightClick Olay
Ortaya çıkar, bir XmlMappedRange denetimi varsayılan sağ tıklatmadan önce eylem sağ,.
Ad alanı: Microsoft.Office.Tools.Excel
Derleme: Microsoft.Office.Tools.Excel (Microsoft.Office.Tools.Excel.dll içinde)
Sözdizimi
'Bildirim
Event BeforeRightClick As DocEvents_BeforeRightClickEventHandler
event DocEvents_BeforeRightClickEventHandler BeforeRightClick
Örnekler
Aşağıdaki kodu için bir işleyici gösterir BeforeRightClick , sağ tıklatma eylemi iptal olayı bir XmlMappedRange.Sağ için izin verilmeyen kullanıcı olay işleyicisi bildirir XmlMappedRangeve sonra ayarlar Cancel parametresi DocEvents_BeforeRightClickEventHandler olay işleyicisi true , Microsoft Office Excel, sağ tıklatma eylemi iptal eder.Bu kod örneği, geçerli çalışma sayfasının içerdiğini varsayar bir XmlMappedRange adlı CustomerLastNameCell.
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 Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen güvenilen kod kitaplıklarını kullanma.