Compartir a través de


Bookmark.SelectionChange (Evento) (2007 System)

Actualización: noviembre 2007

Se produce cuando cambia la selección en el control Bookmark.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word.v9.0 (en Microsoft.Office.Tools.Word.v9.0.dll)

Sintaxis

Public Event SelectionChange As SelectionEventHandler

Dim instance As Bookmark
Dim handler As SelectionEventHandler

AddHandler instance.SelectionChange, handler
public event SelectionEventHandler SelectionChange

Comentarios

Este evento se provoca cuando la selección cambia al control Bookmark o dentro de éste.

Ejemplos

El ejemplo de código siguiente agrega un control Bookmark con texto al documento y, a continuación, crea un controlador de eventos SelectionChange. Se muestra un cuadro de mensaje cuando el cursor se mueve dentro del marcador.

Se trata de un ejemplo para una personalización en el nivel del documento.

WithEvents Bookmark5 As Microsoft.Office.Tools.Word.Bookmark

Private Sub BookmarkSelectionChange()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Bookmark5 = Me.Controls.AddBookmark(Me.Paragraphs(1).Range, _
        "Bookmark5")
    Bookmark5.Text = "This is a sample bookmark."
End Sub

Private Sub Bookmark5_SelectionChange(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.SelectionEventArgs) _
    Handles Bookmark5.SelectionChange
    MessageBox.Show("The selection has changed within Bookmark1.")
End Sub
Microsoft.Office.Tools.Word.Bookmark bookmark5;

private void BookmarkSelectionChange()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    bookmark5 = this.Controls.AddBookmark(this.Paragraphs[1]
        .Range, "bookmark5");
    bookmark5.Text = "This is a sample bookmark.";
    bookmark5.SelectionChange += new Microsoft.Office.Tools.Word.SelectionEventHandler(bookmark5_SelectionChange);
}

void bookmark5_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
    MessageBox.Show("The selection has changed within bookmark1.");
}

Permisos

Vea también

Referencia

Bookmark (Clase)

Bookmark (Miembros)

Microsoft.Office.Tools.Word (Espacio de nombres)