ITextViewLine::GetBufferPositionFromXCoordinate Method (Double, Boolean)

 

Gets the buffer position of the character whose character bounds contains the given x-coordinate.

Namespace:   Microsoft.VisualStudio.Text.Formatting
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Nullable<SnapshotPoint> GetBufferPositionFromXCoordinate(
	double xCoordinate,
	bool textOnly
)

Parameters

xCoordinate
Type: System::Double

The x-coordinate of the desired character.

textOnly
Type: System::Boolean

If true, then this method will return null if xCoordinate is over an adornment.

Return Value

Type: System::Nullable<SnapshotPoint>

The text buffer-based point of the character at xCoordinate, or null if there is no character at that position.

The rightmost edge of a character bound is considered to be contained in its following character. The rightmost edge of the last character's bounds do not map to any character. If textOnly is true and xCoordinate is over an adornment, then the text position associated with the adornment is returned.

Return to top
Show: