共用方式為


EditPoint2.PreviousBookmark 方法

將編輯點移至文件中前一個書籤的位置。

命名空間:  EnvDTE80
組件:  EnvDTE80 (在 EnvDTE80.dll 中)

語法

'宣告
Function PreviousBookmark As Boolean
bool PreviousBookmark()
bool PreviousBookmark()
abstract PreviousBookmark : unit -> bool
function PreviousBookmark() : boolean

傳回值

類型:Boolean
如果編輯點是移到上一個書籤,則為 true,否則為 false。

備註

如果沒有書籤,編輯點將不會移動。

PreviousBookmark 會將 EditPoint 物件移到 EditPoint 現用端點位置之前的第一個書籤。 EditPoint 會在新位置摺疊。

範例

Sub PreviousBookmarkExample(ByVal dte As DTE2)

    ' Create a new text document.
    dte.ItemOperations.NewFile()

    ' Create an EditPoint at the start of the new document.
    Dim doc As TextDocument = _
        CType(dte.ActiveDocument.Object("TextDocument"), TextDocument)
    Dim point As EditPoint = doc.StartPoint.CreateEditPoint
    Dim i As Integer

    ' Insert ten lines of text.
    For i = 1 To 10
        point.Insert("This is a test." & vbCrLf)
    Next

    point.StartOfDocument()

    ' Set a bookmark on each of the first two lines.
    point.SetBookmark()
    point.LineDown(1)
    point.SetBookmark()

    ' Insert text at each bookmark and then clear each bookmark.
    point.PreviousBookmark()
    point.Insert("BOOKMARK 1: ")
    point.ClearBookmark()
    point.NextBookmark()
    point.Insert("BOOKMARK 2: ")
    point.ClearBookmark()

End Sub
public void PreviousBookmarkExample(DTE2 dte)
{
    // Create a new text document.
    dte.ItemOperations.NewFile(@"General\Text File", "", _
        Constants.vsViewKindPrimary);

    // Create an EditPoint at the start of the new document.
    TextDocument doc = _
        (TextDocument)dte.ActiveDocument.Object("TextDocument");
    EditPoint point = doc.StartPoint.CreateEditPoint();

    // Insert ten lines of text.
    for (int i = 1; i <= 10; ++i)
        point.Insert("This is a test.\n");

    point.StartOfDocument();

    // Set a bookmark on each of the first two lines.
    point.SetBookmark();
    point.LineDown(1);
    point.SetBookmark();

    // Insert text at each bookmark and then clear each bookmark.
    point.PreviousBookmark();
    point.Insert("BOOKMARK 1: ");
    point.ClearBookmark();
    point.NextBookmark();
    point.Insert("BOOKMARK 2: ");
    point.ClearBookmark();
}

.NET Framework 安全性

請參閱

參考

EditPoint2 介面

EnvDTE80 命名空間

其他資源

如何:編譯和執行 Automation 物件模型程式碼範例