Compartilhar via


Evento XMLNode.Select (sistema de 2007)

Ocorre quando o cursor é colocado dentro de um XMLNode controle.

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

Sintaxe

Public Event Select As ContextChangeEventHandler

Dim instance As XMLNode
Dim handler As ContextChangeEventHandler

AddHandler instance.Select, handler
public event ContextChangeEventHandler Select

Comentários

The Select evento difere do ContextEnter evento. Para obter mais informações, consulte Controlarar de XMLNode.

Exemplos

O exemplo de código a seguir demonstra evento manipuladores para o Select, Deselect, ContextEnter, e ContextLeave eventos. Quando o Select e Deselect eventos são elevados, os manipuladores de eventos de adicionar linhas duplas às bordas da seleção ou remover as linhas duplas, dependendo do evento. Quando o ContextEnter e ContextLeave evento s são aumentados, o evento manipuladores exibir mensagens que informe os nomes de nó recém-selecionado e o nó anterior ser selecionado. Este exemplo assume que o documento corrente contém uma XMLNode chamada CustomerNode.

PrivateSub CustomerNode_Select(ByVal sender AsObject, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.Select

    e.Selection.Borders.OutsideLineStyle = _
        Word.WdLineStyle.wdLineStyleDouble
EndSubPrivateSub CustomerNode_Deselect(ByVal sender AsObject, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.Deselect

    e.Selection.Borders.OutsideLineStyle = _
        Word.WdLineStyle.wdLineStyleNone
EndSubPrivateSub CustomerNode_ContextEnter(ByVal sender AsObject, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.ContextEnter

    MsgBox("You entered the node '" & e.NewXMLNode.BaseName & "'.")
EndSubPrivateSub CustomerNode_ContextLeave(ByVal sender AsObject, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles CustomerNode.ContextLeave

    MsgBox("You left the node '" & e.OldXMLNode.BaseName & "'.")
EndSub
privatevoid 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 + "'.");
}

Permissões

Consulte também

Referência

XMLNode Classe

Membros XMLNode

Namespace Microsoft.Office.Tools.Word