返回 EditPoint 对象的 AbsoluteCharOffset 属性值是否大于给定 TextPoint 对象的属性值。
命名空间: EnvDTE80
程序集: EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
Function GreaterThan ( _
Point As TextPoint _
) As Boolean
bool GreaterThan(
TextPoint Point
)
bool GreaterThan(
[InAttribute] TextPoint^ Point
)
abstract GreaterThan :
Point:TextPoint -> bool
function GreaterThan(
Point : TextPoint
) : boolean
参数
- Point
类型:EnvDTE.TextPoint
必选。要与调用点对象进行比较的 TextPoint。
返回值
类型:System.Boolean
如果 Point 的 AbsoluteCharOffset 属性值小于调用 EditPoint 对象的 AbsoluteCharOffset 属性值,则为 true;否则为 false。
实现
EditPoint.GreaterThan(TextPoint)
备注
如果 Point 与调用点对象不在同一文档中,GreaterThan 将引发 ArgumentException 异常。 对于 VirtualPoint,如果参数是 VirtualPoint,GreaterThan 将比较虚拟位置,否则它将比较物理位置。
示例
Sub GreaterThanExample(ByVal dte As DTE)
' Create a new text file.
dte.ItemOperations.NewFile()
Dim txtDoc As TextDocument = _
CType(dte.ActiveDocument.Object(), TextDocument)
' Create an edit point at the empty text document's StartPoint
' and EndPoint; CompareEditPoints displays "point1 and point2
' occupy the same ___location."
Dim point1 As EditPoint = txtDoc.StartPoint.CreateEditPoint()
Dim point2 As EditPoint = txtDoc.EndPoint.CreateEditPoint()
CompareEditPoints(point1, point2)
' Insert ten lines of text.
Dim i As Integer
For i = 1 To 10
point1.Insert("Line " & i.ToString() & vbCrLf)
Next
' Create an edit point at the text document's StartPoint and
' EndPoint; CompareEditPoints displays "point1 comes
' before point2."
point1 = txtDoc.StartPoint.CreateEditPoint()
point2 = txtDoc.EndPoint.CreateEditPoint()
CompareEditPoints(point1, point2)
End Sub
Sub CompareEditPoints(ByVal point1 As EditPoint, _
ByVal point2 As EditPoint)
If point1.LessThan(point2) Then
MsgBox("point1 comes before point2.")
ElseIf point1.GreaterThan(point2) Then
MsgBox("point2 comes before point1.")
ElseIf (point1.EqualTo(point2)) Then
MsgBox("point1 and point2 occupy the same ___location.")
End If
End Sub
public void GreaterThanExample(DTE dte)
{
// Create a new text file.
dte.ItemOperations.NewFile(@"General\Text File", "",
Constants.vsViewKindPrimary);
TextDocument txtDoc =
(TextDocument)dte.ActiveDocument.Object("");
// Create an edit point at the empty text document's StartPoint
// and EndPoint; CompareEditPoints displays "point1 and point2
// occupy the same ___location."
EditPoint point1 = txtDoc.StartPoint.CreateEditPoint();
EditPoint point2 = txtDoc.EndPoint.CreateEditPoint();
CompareEditPoints(point1, point2);
// Insert ten lines of text.
for (int i = 1; i <= 10; i++)
{
point1.Insert("Line " + i.ToString() + Environment.NewLine);
}
// Create an edit point at the text document's StartPoint and
// EndPoint; CompareEditPoints displays "point1 comes
// before point2."
point1 = txtDoc.StartPoint.CreateEditPoint();
point2 = txtDoc.EndPoint.CreateEditPoint();
CompareEditPoints(point1, point2);
}
void CompareEditPoints(EditPoint point1, EditPoint point2)
{
if (point1.LessThan(point2))
MessageBox.Show("point1 comes before point2.");
else if (point1.GreaterThan(point2))
MessageBox.Show("point2 comes before point1.");
else if (point1.EqualTo(point2))
MessageBox.Show("point1 and point2 occupy the same ___location.");
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。