Partilhar via


Evento XMLNodes.Select (sistema de 2007)

Ocorre quando o cursor é colocado dentro de um de nós do XMLNodes coleção.

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 XMLNodes
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 XMLNodes.

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 XMLNodes coleção denominada SampleInsertNodes.

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

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

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

    MessageBox.Show("You entered the node '" & _
        e.NewXMLNode.BaseName + "'.")
EndSubPrivateSub SampleInsertNodes_ContextLeave(ByVal sender AsObject, _
    ByVal e As Microsoft.Office.Tools.Word.ContextChangeEventArgs) _
    Handles SampleInsertNodes.ContextLeave

    MessageBox.Show("You left the node '" & _
        e.OldXMLNode.BaseName + "'.")
EndSub
privatevoid XMLNodesSelections()
{
    this.SampleInsertNodes.ContextEnter +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        SampleInsertNodes_ContextEnter);

    this.SampleInsertNodes.ContextLeave +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        SampleInsertNodes_ContextLeave);

    this.SampleInsertNodes.Select +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        SampleInsertNodes_Select);

    this.SampleInsertNodes.Deselect +=
        new Microsoft.Office.Tools.Word.ContextChangeEventHandler(
        SampleInsertNodes_Deselect);
}

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

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

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

void SampleInsertNodes_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

XMLNodes Classe

Membros XMLNodes

Namespace Microsoft.Office.Tools.Word