EditPoint2.PadToColumn(Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将缓冲区中的当前行到给定列用空字符(空格)填充。
public:
void PadToColumn(int Column);
public:
void PadToColumn(int Column);
void PadToColumn(int Column);
[System.Runtime.InteropServices.DispId(131)]
public void PadToColumn (int Column);
[<System.Runtime.InteropServices.DispId(131)>]
abstract member PadToColumn : int -> unit
Public Sub PadToColumn (Column As Integer)
参数
- Column
- Int32
必需。 要填充的列数,从 1 开始。
实现
- 属性
示例
Sub PadToColumnExample(ByVal dte As DTE2)
' Create a new text file.
dte.ItemOperations.NewFile()
' Create an EditPoint at the start of the new file.
Dim doc As TextDocument = _
CType(dte.ActiveDocument.Object("TextDocument"), TextDocument)
Dim point As EditPoint = doc.StartPoint.CreateEditPoint
Dim i As Integer
' Insert ten lines of text.
For i = 1 To 10
point.Insert("This is a test." & vbCrLf)
Next i
point.StartOfDocument()
' Indent text to column 10.
For i = 1 To 10
point.PadToColumn(10)
point.LineDown()
point.StartOfLine()
Next
End Sub
public void PadToColumnExample(DTE2 dte)
{
// Create a new text file.
dte.ItemOperations.NewFile(@"General\Text File", "",
Constants.vsViewKindPrimary);
// Create an EditPoint at the start of the new file.
TextDocument doc =
(TextDocument)dte.ActiveDocument.Object("TextDocument");
EditPoint point = doc.StartPoint.CreateEditPoint();
// Insert ten lines of text.
for (int i = 0; i < 10; i++)
point.Insert("This is a test.\n");
point.StartOfDocument();
// Indent text to column 10.
for (int i = 0; i < 10; i++)
{
point.PadToColumn(10);
point.LineDown(1);
point.StartOfLine();
}
}
注解
PadToColumn 根据全局设置,从编辑点或选择的显示列到指定的显示列插入制表符和空格。 如果所选内容的编辑点或活动端已超出指定的列,则 PadToColumn 不执行任何操作。