XmlMappedRange.Deselected 事件 (2007 system)

更新:2007 年 11 月

当所选内容从 XmlMappedRange 控件移动至 XmlMappedRange 控件之外的某个区域时发生。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel.v9.0(在 Microsoft.Office.Tools.Excel.v9.0.dll 中)

语法

声明
Public Event Deselected As DocEvents_SelectionChangeEventHandler
用法
Dim instance As XmlMappedRange
Dim handler As DocEvents_SelectionChangeEventHandler

AddHandler instance.Deselected, handler
public 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(missing, missing,
        Excel.XlReferenceStyle.xlA1, missing, missing);

    MessageBox.Show("CustomerLastNameCell was deselected. The new " +
        "selection is " + deselectedRange);
}

权限

另请参见

参考

XmlMappedRange 类

XmlMappedRange 成员

Microsoft.Office.Tools.Excel 命名空间