共用方式為


IVsLanguageBlock.GetCurrentBlock 方法

判斷目前的語言區塊範圍。

命名空間:  Microsoft.VisualStudio.TextManager.Interop
組件:  Microsoft.VisualStudio.TextManager.Interop (在 Microsoft.VisualStudio.TextManager.Interop.dll 中)

語法

'宣告
Function GetCurrentBlock ( _
    pTextLines As IVsTextLines, _
    iCurrentLine As Integer, _
    iCurrentChar As Integer, _
    <OutAttribute> ptsBlockSpan As TextSpan(), _
    <OutAttribute> ByRef pbstrDescription As String, _
    <OutAttribute> ByRef pfBlockAvailable As Integer _
) As Integer
int GetCurrentBlock(
    IVsTextLines pTextLines,
    int iCurrentLine,
    int iCurrentChar,
    TextSpan[] ptsBlockSpan,
    out string pbstrDescription,
    out int pfBlockAvailable
)
int GetCurrentBlock(
    [InAttribute] IVsTextLines^ pTextLines, 
    [InAttribute] int iCurrentLine, 
    [InAttribute] int iCurrentChar, 
    [OutAttribute] array<TextSpan>^ ptsBlockSpan, 
    [OutAttribute] String^% pbstrDescription, 
    [OutAttribute] int% pfBlockAvailable
)
abstract GetCurrentBlock : 
        pTextLines:IVsTextLines * 
        iCurrentLine:int * 
        iCurrentChar:int * 
        ptsBlockSpan:TextSpan[] byref * 
        pbstrDescription:string byref * 
        pfBlockAvailable:int byref -> int
function GetCurrentBlock(
    pTextLines : IVsTextLines, 
    iCurrentLine : int, 
    iCurrentChar : int, 
    ptsBlockSpan : TextSpan[], 
    pbstrDescription : String, 
    pfBlockAvailable : int
) : int

參數

  • iCurrentLine
    類型:Int32

    [in]游標的目前行位置。

  • iCurrentChar
    類型:Int32

    [in]目前的行中的資料指標的字元位置。

  • pbstrDescription
    類型:String%

    [] out傳回字串,其中包含語言區塊的描述。

  • pfBlockAvailable
    類型:Int32%

    [retval] out傳回非零如果區塊是可用。 如果目前的游標位置與語言區塊不一致,否則傳回 0。

傳回值

類型:Int32
如果此方法將會成功,則會傳回S_OK。如果失敗,它就會傳回錯誤碼。

備註

COM 簽章

從 textmgr.idl:

HRESULT IVsLanguageBlock::GetCurrentBlock(
   [in] IVsTextLines * pTextLines, 
   [in] LONG iCurrentLine, 
   [in] LONG iCurrentChar, 
   [out] TextSpan * ptsBlockSpan, 
   [out] BSTR * pbstrDescription
);

由於目前的位置,則這個方法會傳回TextSpan定義封入或附近的文字區塊和簡短描述區塊的結構。

通常會呼叫這個方法從檢視中,以填入尋找 ] 對話方塊的 「只用於搜尋: < 目前的程序 >"選項 where < 目前的程序 > 是pbstrDescription的文字。 描述應該是有限的空間,在短對話方塊。

pfBlockAvailable參數必須設為非零可用區塊時,任何區塊外的位置不加零。 值ptsBlockSpan和pbstrDescription參數可能是 null 值,指出這些參數都不想要由呼叫端。

.NET Framework 安全性

請參閱

參考

IVsLanguageBlock 介面

Microsoft.VisualStudio.TextManager.Interop 命名空間