XmlMappedRange.Deselected 事件
當 XmlMappedRange 控制項中的選取範圍移到 XmlMappedRange 控制項以外的區域時發生。
命名空間: Microsoft.Office.Tools.Excel
組件: Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)
語法
'宣告
Event Deselected As DocEvents_SelectionChangeEventHandler
event DocEvents_SelectionChangeEventHandler Deselected
備註
只有當 XmlMappedRange 控制項含有焦點,而焦點從 XmlMappedRange 控制項移轉出時,才會引發這個事件。
範例
下列程式碼會示範 Deselected 事件的處理常式,當取消選取 XmlMappedRange 時,便顯示新選取範圍的位址。這個程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange。
Sub CustomerLastNameCell_Deselected(ByVal Target As Excel.Range) _
Handles CustomerLastNameCell.Deselected
Dim deselectedRange As String = Target.Address( _
ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
MsgBox("CustomerLastNameCell was deselected. " & _
"The new selection is " & deselectedRange)
End Sub
private void XmlMappedRange_Deselected()
{
this.CustomerLastNameCell.Deselected +=
new Excel.DocEvents_SelectionChangeEventHandler(
CustomerLastNameCell_Deselected);
}
void CustomerLastNameCell_Deselected(Excel.Range Target)
{
string deselectedRange = Target.get_Address(Excel.XlReferenceStyle.xlA1);
MessageBox.Show("CustomerLastNameCell was deselected. The new " +
"selection is " + deselectedRange);
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。