Partilhar via


Interface TextRange

Representa um Simples, seção contígua de texto em um documento de texto.

Namespace:  EnvDTE
Assembly:  EnvDTE (em EnvDTE. dll)

Sintaxe

<GuidAttribute("72767524-E3B3-43D0-BB46-BBE1D556A9FF")> _
Public Interface TextRange

Dim instance As TextRange
[GuidAttribute("72767524-E3B3-43D0-BB46-BBE1D556A9FF")]
public interface TextRange
[GuidAttribute(L"72767524-E3B3-43D0-BB46-BBE1D556A9FF")]
public interface class TextRange
public interface TextRange

Comentários

A seção de texto é delimitada por um par de objetos de EditPoint.

TextRange objetos são usados quando você tem expressões regulares com subexpressions marcados.Um coleção de intervalos é retornado, um para cada subexpressão correspondente, e suas propriedades são somente leitura.

Para Geral manipulação de texto, é recomendável que você usar objetos, como TextSelection ou EditPoint, pois o objeto TextSelection relacionado diretamente à seleção visível na tela.Quando a área de seleção altera, alteração de coordenadas do objeto e vice-versa.Como resultado, uma seleção de texto não pode ser usada para representar um intervalo arbitrário de texto sem interromper a seleção de texto.

Exemplos

Sub TextRangeExample(ByVal dte As EnvDTE.DTE)
    Dim objTxtSel As TextSelection
    Dim colRanges As TextRanges
    Dim objRange As TextRange
    Dim objEP As EditPoint

    objTxtSel = dte.ActiveDocument.Selection
    colRanges = objTxtSel.TextRanges
    For Each objRange In colRanges
        objRange.StartPoint.Insert("/*")
        objRange.EndPoint.Insert("*/")
    Next
End Sub
public void TextRangeExample(_DTE dte)
{
    TextSelection ts;
    TextRanges trs;

    ts = (TextSelection)dte.ActiveDocument.Selection;
    trs = ts.TextRanges;
    MessageBox.Show (trs.Count.ToString ());
    foreach (TextRange tr in trs)
    {
        tr.StartPoint.Insert ("/*");
        tr.EndPoint.Insert ("*/");
    }
}

Consulte também

Referência

TextRange Membros

Espaço para nome EnvDTE