共用方式為


Source.GetWordExtent Method

Gets the span occupied by the word at the specified location.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'宣告
Public Function GetWordExtent ( _
    line As Integer, _
    idx As Integer, _
    flags As WORDEXTFLAGS, _
    <OutAttribute> ByRef startIdx As Integer, _
    <OutAttribute> ByRef endIdx As Integer _
) As Boolean
'用途
Dim instance As Source
Dim line As Integer
Dim idx As Integer
Dim flags As WORDEXTFLAGS
Dim startIdx As Integer
Dim endIdx As Integer
Dim returnValue As Boolean

returnValue = instance.GetWordExtent(line, _
    idx, flags, startIdx, endIdx)
public bool GetWordExtent(
    int line,
    int idx,
    WORDEXTFLAGS flags,
    out int startIdx,
    out int endIdx
)
public:
bool GetWordExtent(
    int line, 
    int idx, 
    WORDEXTFLAGS flags, 
    [OutAttribute] int% startIdx, 
    [OutAttribute] int% endIdx
)
member GetWordExtent : 
        line:int * 
        idx:int * 
        flags:WORDEXTFLAGS * 
        startIdx:int byref * 
        endIdx:int byref -> bool 
public function GetWordExtent(
    line : int, 
    idx : int, 
    flags : WORDEXTFLAGS, 
    startIdx : int, 
    endIdx : int
) : boolean

Parameters

  • line
    Type: System.Int32
    The line on which the word to examine is located.
  • idx
    Type: System.Int32
    The offset into the line to somewhere in the word (does not have to be at the beginning of the word).
  • startIdx
    Type: System.Int32%
    [out] Returns the offset of the first character of the word.
  • endIdx
    Type: System.Int32%
    [out] Returns the offset of the character one past the last character of the word.

Return Value

Type: System.Boolean
true if the word was found; otherwise, false, meaning that there is no word at that position.

Remarks

This method calls the colorizer's GetLineInfo method to obtain the list of tokens for the specified line. Then using the token list and the specified flags, this method proceeds to find the requested token.

.NET Framework Security

See Also

Reference

Source Class

Source Members

Microsoft.VisualStudio.Package Namespace