IVsTextLines.CanReplaceLines Method
Tests whether a given editing operation such as copy or cut can succeed.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'宣言
Function CanReplaceLines ( _
iStartLine As Integer, _
iStartIndex As Integer, _
iEndLine As Integer, _
iEndIndex As Integer, _
iNewLen As Integer _
) As Integer
'使用
Dim instance As IVsTextLines
Dim iStartLine As Integer
Dim iStartIndex As Integer
Dim iEndLine As Integer
Dim iEndIndex As Integer
Dim iNewLen As Integer
Dim returnValue As Integer
returnValue = instance.CanReplaceLines(iStartLine, _
iStartIndex, iEndLine, iEndIndex, _
iNewLen)
int CanReplaceLines(
int iStartLine,
int iStartIndex,
int iEndLine,
int iEndIndex,
int iNewLen
)
int CanReplaceLines(
[InAttribute] int iStartLine,
[InAttribute] int iStartIndex,
[InAttribute] int iEndLine,
[InAttribute] int iEndIndex,
[InAttribute] int iNewLen
)
function CanReplaceLines(
iStartLine : int,
iStartIndex : int,
iEndLine : int,
iEndIndex : int,
iNewLen : int
) : int
Parameters
iStartLine
Type: System.Int32[in] Starting line.
iStartIndex
Type: System.Int32[in] Starting character index within the line. Must be less than or equal to the length of the line.
iEndLine
Type: System.Int32[in] Ending line.
iEndIndex
Type: System.Int32[in] Ending character index within the line. Must be less than or equal to the length of the line.
iNewLen
Type: System.Int32[in] Length of the newly inserted text.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From textmgr.idl:
HRESULT IVsTextLines::CanReplaceLines(
[in] long iStartLine,
[in] CharIndex iStartIndex,
[in] long iEndLine,
[in] CharIndex iEndIndex,
[in] long iNewLen
);
In the text buffer, every change is modeled as a replace operation, regardless of whether text is inserted, replaced, or deleted within the line. As such, this method contains a starting index position and an ending index position, although in an insert operation these points would be the same.
This method is used to test whether editing operations such as cut or copy can succeed. Potential causes for failure include attempting to replace text in a read-only buffer (that is, the file is under source control), or attempting to replace text in a read-only region within the buffer.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.