共用方式為


IEditorOperations.InsertTextAsBox Method

Inserts the specified text at the current caret position as a box.

Namespace:  Microsoft.VisualStudio.Text.Operations
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

'宣告
Function InsertTextAsBox ( _
    text As String, _
    <OutAttribute> ByRef boxStart As VirtualSnapshotPoint, _
    <OutAttribute> ByRef boxEnd As VirtualSnapshotPoint _
) As Boolean
bool InsertTextAsBox(
    string text,
    out VirtualSnapshotPoint boxStart,
    out VirtualSnapshotPoint boxEnd
)
bool InsertTextAsBox(
    String^ text, 
    [OutAttribute] VirtualSnapshotPoint% boxStart, 
    [OutAttribute] VirtualSnapshotPoint% boxEnd
)
abstract InsertTextAsBox : 
        text:string * 
        boxStart:VirtualSnapshotPoint byref * 
        boxEnd:VirtualSnapshotPoint byref -> bool 
function InsertTextAsBox(
    text : String, 
    boxStart : VirtualSnapshotPoint, 
    boxEnd : VirtualSnapshotPoint
) : boolean

Parameters

  • text
    Type: System.String
    The text to be inserted in the buffer. Each "line" from the text will be written out a line at a time.

Return Value

Type: System.Boolean
true if the edit succeeded, otherwise false.

Exceptions

Exception Condition
ArgumentNullException

text is nulla null reference (Nothing in Visual Basic).

Remarks

This method has the same behavior as copying and pasting a box selection. In order to insert the text as a box, text is split by newlines and inserted a line at a time, each one on a successive line below the line the caret is on, starting at the caret's x coordinate on each line.

.NET Framework Security

See Also

Reference

IEditorOperations Interface

Microsoft.VisualStudio.Text.Operations Namespace