Επεξεργασία

Κοινή χρήση μέσω


TextBlock.GetPositionFromPoint(Point, Boolean) Method

Definition

Returns a TextPointer to the position closest to a specified Point.

public:
 System::Windows::Documents::TextPointer ^ GetPositionFromPoint(System::Windows::Point point, bool snapToText);
public System.Windows.Documents.TextPointer GetPositionFromPoint (System.Windows.Point point, bool snapToText);
member this.GetPositionFromPoint : System.Windows.Point * bool -> System.Windows.Documents.TextPointer
Public Function GetPositionFromPoint (point As Point, snapToText As Boolean) As TextPointer

Parameters

point
Point

A Point in the coordinate space of the TextBlock for which to return a TextPointer.

snapToText
Boolean

true to return a TextPointer to the insertion point closest to point, whether or not point is inside a character's bounding box; false to return null if point is not inside a character's bounding box.

Returns

A TextPointer to the specified point, or null if snapToText is false and the specified point does not fall within a character bounding box in the TextBlock content area.

Exceptions

Current, valid layout information for the control is unavailable.

Remarks

This method always returns a valid TextPointer when snapToText is true.

Applies to