共用方式為


XmlMappedRange.Deselected 事件 (2007 系統)

更新: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 命名空間