Compartilhar via


Evento XMLNode.Deselect

Ocorre quando o cursor é movido para fora do controle de XMLNode .

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (em Microsoft.Office.Tools.Word.dll)

Sintaxe

'Declaração
Event Deselect As ContextChangeEventHandler
event ContextChangeEventHandler Deselect

Comentários

O evento de Deselect difere do evento de ContextLeave .Para obter mais informações, consulte Controle de XMLNode.

Exemplos

O exemplo de código a seguir demonstra manipuladores de eventos para Select, Deselect, ContextEnter, e eventos de ContextLeave .Quando os eventos de Select e de Deselect são gerados, os manipuladores de eventos adiciona linhas duplas às bordas de seleção ou remover linhas duplas, dependendo do evento.Quando os eventos de ContextEnter e de ContextLeave são gerados, os manipuladores de eventos exibem mensagens que indica os nomes do nó selecionado e recentemente do nó selecionado anteriormente.Este exemplo assume que o documento atual contiver XMLNode chamado CustomerNode.

Private Sub CustomerNode_Select(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.Select

    e.Selection.Borders.OutsideLineStyle = _
        Word.WdLineStyle.wdLineStyleDouble
End Sub

Private Sub CustomerNode_Deselect(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.Deselect

    e.Selection.Borders.OutsideLineStyle = _
        Word.WdLineStyle.wdLineStyleNone
End Sub

Private Sub CustomerNode_ContextEnter(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.ContextEnter

    MsgBox("You entered the node '" & e.NewXMLNode.BaseName & "'.")
End Sub

Private Sub CustomerNode_ContextLeave(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.ContextLeave

    MsgBox("You left the node '" & e.OldXMLNode.BaseName & "'.")
End Sub
private void XMLNodeSelections()
{
    this.CustomerNode.ContextEnter +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        CustomerNode_ContextEnter);

    this.CustomerNode.ContextLeave +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        CustomerNode_ContextLeave);

    this.CustomerNode.Select += 
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        CustomerNode_Select); 

    this.CustomerNode.Deselect +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        CustomerNode_Deselect);
}

void CustomerNode_Select(object sender, 
    Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
    e.Selection.Borders.OutsideLineStyle =
        Word.WdLineStyle.wdLineStyleDouble;
}

void CustomerNode_Deselect(object sender,
    Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
    e.Selection.Borders.OutsideLineStyle =
        Word.WdLineStyle.wdLineStyleNone;
}

void CustomerNode_ContextEnter(object sender,
    Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
    MessageBox.Show("You entered the node '" +
        e.NewXMLNode.BaseName + "'.");
}

void CustomerNode_ContextLeave(object sender,
    Microsoft.Office.Tools.Word.ContextChangeEventArgs e)
{
    MessageBox.Show("You left the node '" +
        e.OldXMLNode.BaseName + "'.");
}

Segurança do .NET Framework

Consulte também

Referência

XMLNode Interface

Namespace Microsoft.Office.Tools.Word