編輯

共用方式為


TextRange.Select(TextPointer, TextPointer) Method

Definition

Updates the current selection, taking two TextPointer positions to indicate the updated selection.

public:
 void Select(System::Windows::Documents::TextPointer ^ position1, System::Windows::Documents::TextPointer ^ position2);
public void Select (System.Windows.Documents.TextPointer position1, System.Windows.Documents.TextPointer position2);
member this.Select : System.Windows.Documents.TextPointer * System.Windows.Documents.TextPointer -> unit
Public Sub Select (position1 As TextPointer, position2 As TextPointer)

Parameters

position1
TextPointer

A fixed anchor position that marks one end of the updated selection.

position2
TextPointer

A movable position that marks the other end of the updated selection.

Exceptions

Occurs when position1 and position2 are not positioned within the same document.

Occurs when position1 or position2 is null.

Remarks

A TextRange is formed from a selection between two positions indicated by TextPointers. One of these positions (indicated by position1) is fixed with respect to the selection, while the other position (indicated by position2) is movable. This is similar to how a selection made by a user using the mouse or keyboard behaves.

The actual ends of the new selection may be adjusted to match any selection heuristics that are applicable to the document that contains the new current selection.

Applies to