Bookmark.IsEqual(Range) Yöntem

Tanım

BookmarkBu yöntemin uygulandığı denetimin bağımsız değişken tarafından belirtilen aralığa eşit olup olmadığını belirler Range .

public bool IsEqual (Microsoft.Office.Interop.Word.Range Range);

Parametreler

Range
Range

RangeDenetimiyle karşılaştırılan nesne Bookmark .

Döndürülenler

Boolean

trueBookmarkBu yöntemin uygulandığı denetim bağımsız değişken tarafından belirtilen aralığa eşitse Range ; Aksi takdirde, false .

Örnekler

Aşağıdaki kod örneği, Bookmark belgeye metin içeren bir denetim ekler ve yer işaretinin aralığının ilk paragraf aralığına eşit olup olmadığını denetler.

Bu örnek, belge düzeyinde özelleştirme içindir

private void BookmarkIsEqual()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";
    bookmark1.InsertAfter(" This is additional text.");
    if (bookmark1.IsEqual(this.Paragraphs[1].Range))
    {
        MessageBox.Show("The bookmark's range is equal to "+
            "the range of the first paragraph.");
    }
    else
    {
        MessageBox.Show("The bookmark's range is not equal to " +
            "the range of the first paragraph.");
    }
}
Private Sub BookmarkIsEqual()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "This is sample bookmark text."
    Bookmark1.InsertAfter(" This is additional text.")

    If Bookmark1.IsEqual(Me.Paragraphs(1).Range) Then
        MessageBox.Show("The bookmark's range is equal to " _
            & "the range of the first paragraph.")
    Else
        MessageBox.Show("The bookmark's range is not equal to " _
            & "the range of the first paragraph.")
    End If

End Sub

Açıklamalar

Bu yöntem, başlangıç ve bitiş karakter konumlarını ve hikaye türünü karşılaştırır. Bu öğelerin üçü her iki nesne için de aynıysa, nesneler eşittir.

İsteğe Bağlı Parametreler

İsteğe bağlı parametreler hakkında daha fazla bilgi için bkz. Office çözümlerinde Isteğe bağlı parametreler.

Şunlara uygulanır