Share via


EditPoint.ReplaceText 메서드

선택한 텍스트를 지정한 텍스트로 바꿉니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Sub ReplaceText ( _
    PointOrCount As Object, _
    Text As String, _
    Flags As Integer _
)
void ReplaceText(
    Object PointOrCount,
    string Text,
    int Flags
)
void ReplaceText(
    [InAttribute] Object^ PointOrCount, 
    [InAttribute] String^ Text, 
    [InAttribute] int Flags
)
abstract ReplaceText : 
        PointOrCount:Object * 
        Text:string * 
        Flags:int -> unit 
function ReplaceText(
    PointOrCount : Object, 
    Text : String, 
    Flags : int
)

매개 변수

  • PointOrCount
    형식: System.Object
    필수적 요소로서,바꿀 텍스트를 결정하는 정수 또는 TextPoint 개체입니다.
  • Text
    형식: System.String
    필수적 요소로서,삽입할 텍스트입니다.

설명

ReplaceText는 편집 지점과 PointOrCount 사이의 텍스트를 Text로 바꿔 중단점, 명명된 바로 가기 등의 마커 위치를 올바로 유지하려고 합니다.

예제

Sub ReplaceTextExample()
   Dim objTextDoc As TextDocument
   Dim objMovePt As EditPoint
   Dim objEditPt As EditPoint, iCtr As Integer

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objMovePt = objTextDoc.EndPoint.CreateEditPoint
   objEditPt = objTextDoc.StartPoint.CreateEditPoint

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objEditPt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   objMovePt.EndOfDocument()
   ' Replace all occurrences of "test" with "thing."
   MsgBox("Replacing all text with a new string...")
   objEditPt.ReplaceText(objMovePt, "ALL TEXT REPLACED WITH THIS SENTENCE.", vsEPReplaceTextOptions.vsEPReplaceTextAutoformat)
End Sub

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

EditPoint 인터페이스

EnvDTE 네임스페이스