IVsTextLayer.CopyLineText 方法

将文本指定的范围到调用方分配的缓冲区

命名空间:  Microsoft.VisualStudio.TextManager.Interop
程序集:  Microsoft.VisualStudio.TextManager.Interop(在 Microsoft.VisualStudio.TextManager.Interop.dll 中)

语法

声明
Function CopyLineText ( _
    iStartLine As Integer, _
    iStartIndex As Integer, _
    iEndLine As Integer, _
    iEndIndex As Integer, _
    pszBuf As IntPtr, _
    <OutAttribute> ByRef pcchBuf As Integer _
) As Integer
int CopyLineText(
    int iStartLine,
    int iStartIndex,
    int iEndLine,
    int iEndIndex,
    IntPtr pszBuf,
    out int pcchBuf
)
int CopyLineText(
    [InAttribute] int iStartLine, 
    [InAttribute] int iStartIndex, 
    [InAttribute] int iEndLine, 
    [InAttribute] int iEndIndex, 
    [InAttribute] IntPtr pszBuf, 
    [InAttribute] [OutAttribute] int% pcchBuf
)
abstract CopyLineText : 
        iStartLine:int * 
        iStartIndex:int * 
        iEndLine:int * 
        iEndIndex:int * 
        pszBuf:IntPtr * 
        pcchBuf:int byref -> int
function CopyLineText(
    iStartLine : int, 
    iStartIndex : int, 
    iEndLine : int, 
    iEndIndex : int, 
    pszBuf : IntPtr, 
    pcchBuf : int
) : int

参数

  • iStartLine
    类型:Int32

    [in] 启动行

  • iStartIndex
    类型:Int32

    [in] 在行内开始字符索引 (必须是行的 AMP_LT= 长度)

  • iEndLine
    类型:Int32

    [in] 结束行

  • iEndIndex
    类型:Int32

    [in] 在行内结束字符索引 (必须是行的 AMP_LT= 长度)

  • pszBuf
    类型:IntPtr

    [in] 要插入的文本,因此,如果任何

  • pcchBuf
    类型:Int32%

    [in, out] 在输入,要复制的字符数。 在输出,缓冲区所需的大小。 计数为 UNICODE 字符,而不是字节。

返回值

类型:Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。

备注

COM 签名

从 textmgr.idl:

HRESULT IVsTextLayer::CopyLineText(
   [in] long iStartLine,
   [in] CharIndex iStartIndex,
   [in] long iEndLine,
   [in] CharIndex iEndIndex,
   [in] LPWSTR pszBuf,
   [in, out] long * pcchBuf
);

CopyLineText 将复制到 cchBuf 字符。 如果缓冲区大小不足以的, CopyLineText 返回 BUFFER_E_DEST_TOO_SMALL 并设置 * 为所需大小。

备注

pcchBuf 包含计数 UNICODE 字符,而不是字节。

获取所需的大小,则可以设置 pszBuf 到 nullnull 引用(在 Visual Basic 中为 Nothing)。

.NET Framework 安全性

请参阅

参考

IVsTextLayer 接口

Microsoft.VisualStudio.TextManager.Interop 命名空间