Export (0) Print
Expand All

TextBlock.GetPositionFromPoint Method

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

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)

public TextPointer GetPositionFromPoint (
	Point point,
	bool snapToText
)
public TextPointer GetPositionFromPoint (
	Point point, 
	boolean snapToText
)
public function GetPositionFromPoint (
	point : Point, 
	snapToText : boolean
) : TextPointer
You cannot use methods in XAML.

Parameters

point

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

snapToText

A Boolean value that indicates whether or not to return a TextPointer when the specified point is outside of a character bounding box in the TextBlock content area.

If true, and if point does not fall within a character bounding box, this method will return a TextPointer to a valid position closest to point.

If false, and if point does not fall within a character bounding box, this method will return null

Return Value

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.

Exception typeCondition

InvalidOperationException

Raised when current, valid layout information for the control is unavailable.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft