共用方式為


IVsTextLines.GetLineText 方法

傳回 BSTR 的文字指定的範圍。

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

語法

'宣告
Function GetLineText ( _
    iStartLine As Integer, _
    iStartIndex As Integer, _
    iEndLine As Integer, _
    iEndIndex As Integer, _
    <OutAttribute> ByRef pbstrBuf As String _
) As Integer
int GetLineText(
    int iStartLine,
    int iStartIndex,
    int iEndLine,
    int iEndIndex,
    out string pbstrBuf
)
int GetLineText(
    [InAttribute] int iStartLine, 
    [InAttribute] int iStartIndex, 
    [InAttribute] int iEndLine, 
    [InAttribute] int iEndIndex, 
    [OutAttribute] String^% pbstrBuf
)
abstract GetLineText : 
        iStartLine:int * 
        iStartIndex:int * 
        iEndLine:int * 
        iEndIndex:int * 
        pbstrBuf:string byref -> int
function GetLineText(
    iStartLine : int, 
    iStartIndex : int, 
    iEndLine : int, 
    iEndIndex : int, 
    pbstrBuf : String
) : int

參數

  • iStartLine
    類型:Int32

    [in]起始行。

  • iStartIndex
    類型:Int32

    [in]起始的行內的字元索引。 這個值必須小於或等於線條的長度。

  • iEndLine
    類型:Int32

    [in]結束行。

  • iEndIndex
    類型:Int32

    [in]結束的行內的字元索引。 這個值必須小於或等於線條的長度。

  • pbstrBuf
    類型:String%

    [] out如果有任何插入的文字。

傳回值

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

備註

COM 簽章

從 textmgr.idl:

HRESULT IVsTextLines::GetLineText(
   [in] long iStartLine,
   [in] CharIndex iStartIndex,
   [in] long iEndLine,
   [in] CharIndex iEndIndex,
   [out] BSTR * pbstrBuf
);

它是以解救 BSTR 的呼叫端的責任。

.NET Framework 安全性

請參閱

參考

IVsTextLines 介面

Microsoft.VisualStudio.TextManager.Interop 命名空間