EditPoint.SetBookmark 메서드
버퍼의 현재 줄에 명명되지 않은 책갈피를 설정합니다.
네임스페이스: EnvDTE
어셈블리: EnvDTE(EnvDTE.dll)
구문
‘선언
Sub SetBookmark
void SetBookmark()
void SetBookmark()
abstract SetBookmark : unit -> unit
function SetBookmark()
예제
Sub SetBookmarkExample(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 SetBookmarkExample(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 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용를 참조하세요.