TextRange.End Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get the position that marks the end of the current selection.
public:
property System::Windows::Documents::TextPointer ^ End { System::Windows::Documents::TextPointer ^ get(); };
public System.Windows.Documents.TextPointer End { get; }
member this.End : System.Windows.Documents.TextPointer
Public ReadOnly Property End As TextPointer
Property Value
A TextPointer that points to the end of the current selection.
Examples
The following example demonstrates the use of the End property.
// This method returns true if two specified selections overlap, including when the
// end of one selection serves as the beginning of the other.
bool DoSelectionsOverlap(TextRange selection1, TextRange selection2)
{
// Is either end of selection2 contained by selection1?
if (selection1.Contains(selection2.Start) || selection1.Contains(selection2.End))
{
// If so, the selections overlap.
return true;
}
// If not, selection2 may still entirely contain selection1.
// Is either end of selection1 contained by seleciotn2?
else if (selection2.Contains(selection1.Start) || selection2.Contains(selection1.End))
{
// If so, the selections overlap.
return true;
}
// If neither selection contains the begging or end of the other selection,
//the selections do not overlap.
else
{
return false;
}
}
' This method returns true if two specified selections overlap, including when the
' end of one selection serves as the beginning of the other.
Private Function DoSelectionsOverlap(ByVal selection1 As TextRange, ByVal selection2 As TextRange) As Boolean
' Is either end of selection2 contained by selection1?
If selection1.Contains(selection2.Start) OrElse selection1.Contains(selection2.End) Then
' If so, the selections overlap.
Return True
' If not, selection2 may still entirely contain selection1.
' Is either end of selection1 contained by seleciotn2?
ElseIf selection2.Contains(selection1.Start) OrElse selection2.Contains(selection1.End) Then
' If so, the selections overlap.
Return True
' If neither selection contains the begging or end of the other selection,
'the selections do not overlap.
Else
Return False
End If
End Function
Applies to
See also
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET