New to Telerik UI for WinFormsStart a free 30-day trial

Represents position in RadDocument.

Definition

Namespace:Telerik.WinForms.Documents

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class DocumentPosition : IComparable<DocumentPosition>, IDisposable

Inheritance: objectDocumentPosition

Implements: IComparable<DocumentPosition>IDisposable

Constructors

Initializes a new instance of the DocumentPosition class.

C#
public DocumentPosition(DocumentLayoutBox documentBox, bool trackDocumentChangeEvents)
Parameters:documentBoxDocumentLayoutBox

The DocumentLayoutBox of RadDocument in which the position will be used.

trackDocumentChangeEventsbool

Indicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.

Initializes a new instance of the DocumentPosition class.

C#
public DocumentPosition(DocumentLayoutBox documentBox)
Parameters:documentBoxDocumentLayoutBox

The DocumentLayoutBox of RadDocument.

Initializes a new instance of the DocumentPosition class.

C#
public DocumentPosition(DocumentPosition documentPosition, bool trackDocumentChangeEvents)
Parameters:documentPositionDocumentPosition

The document position to copy.

trackDocumentChangeEventsbool

Indicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.

Initializes a new instance of the DocumentPosition class.

C#
public DocumentPosition(DocumentPosition documentPosition)
Parameters:documentPositionDocumentPosition

The document position to copy.

Initializes a new instance of the DocumentPosition class.

C#
public DocumentPosition(RadDocument document, bool trackDocumentChangeEvents)
Parameters:documentRadDocument

An instance of RadDocument in which the position will be used.

trackDocumentChangeEventsbool

Indicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.

Initializes a new instance of the DocumentPosition class.

C#
public DocumentPosition(RadDocument document)
Parameters:documentRadDocument

An instance of RadDocument in which the position will be used.

Properties

Determines whether the DocumentPosition is at the end of the document.

C#
public bool IsPositionAtDocumentEnd { get; }

Determines whether the DocumentPosition is at the start of the document.

C#
public bool IsPositionAtDocumentStart { get; }

Determines whether the DocumentPosition is at the end of a Paragraph.

C#
public bool IsPositionAtParagraphEnd { get; }

Determines whether the DocumentPosition is at the start of a Paragraph.

C#
public bool IsPositionAtParagraphStart { get; }

Determines whether the DocumentPosition is at the end of a TableCell.

C#
public bool IsPositionAtTableCellEnd { get; }

Determines whether the DocumentPosition is at the start of a TableCell.

C#
public bool IsPositionAtTableCellStart { get; }

Determines whether the DocumentPosition is at the start of a TableRow.

C#
public bool IsPositionAtTableRowStart { get; }

Gets a value indicating whether this position is inside table.

C#
public bool IsPositionInsideTable { get; }
Property Value:

true if this position is inside table; otherwise, false.

Gets a value representing the layout position of this document position.

C#
public PointF Location { get; }

Methods

Compares the current object with another object of the same type.

C#
public int CompareTo(DocumentPosition other)
Parameters:otherDocumentPosition

An object to compare with this object.

Returns:

int

A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.

Implements: IComparable<DocumentPosition>.CompareTo(DocumentPosition)

Disposes this DocumentPosition.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Determines whether the specified object, is equal to this instance.

C#
public override bool Equals(object obj)
Parameters:objobject

The object to compare with this instance.

Returns:

bool

true if the specified object is equal to this instance; otherwise, false.

Overrides: object.Equals(object)

Gets the current Inline.

C#
public Inline GetCurrentInline()
Returns:

Inline

The current Inline element if the position is in an Inline. Otherwise, null.

Gets the current InlineLayoutBox.

C#
public InlineLayoutBox GetCurrentInlineBox()
Returns:

InlineLayoutBox

The current InlineLayoutBox. If such cannot be found, the method returns null.

Gets the current Paragraph.

C#
public Paragraph GetCurrentParagraph()
Returns:

Paragraph

The current Paragraph element if the position is in a Paragraph. Otherwise, null.

Gets the current ParagraphLayoutBox.

C#
public ParagraphLayoutBox GetCurrentParagraphBox()
Returns:

ParagraphLayoutBox

The current ParagraphLayoutBox. If such cannot be found, the method returns null.

Gets the current SectionLayoutBox.

C#
public SectionLayoutBox GetCurrentSectionBox()
Returns:

SectionLayoutBox

The current SectionLayoutBox. If such cannot be found, the method returns null.

Gets the current Span.

C#
public Span GetCurrentSpan()
Returns:

Span

The current Span element if the position is in a Span. Otherwise, null.

Gets the current SpanLayoutBox.

C#
public SpanLayoutBox GetCurrentSpanBox()
Returns:

SpanLayoutBox

The current SpanLayoutBox. If such cannot be found, the method returns null.

Gets the current Table.

C#
public Table GetCurrentTable()
Returns:

Table

The current Table element if the position is in a Table. Otherwise, null.

Gets the current TableLayoutBox.

C#
public TableLayoutBox GetCurrentTableBox()
Returns:

TableLayoutBox

The current TableLayoutBox. If such cannot be found, the method returns null.

Gets the current TableCell.

C#
public TableCell GetCurrentTableCell()
Returns:

TableCell

The current TableCell element if the position is in a TableCell. Otherwise, null.

Gets the current TableCellLayoutBox.

C#
public TableCellLayoutBox GetCurrentTableCellBox()
Returns:

TableCellLayoutBox

The current TableCellLayoutBox. If such cannot be found, the method returns null.

Gets the current TableRow.

C#
public TableRow GetCurrentTableRow()
Returns:

TableRow

The current TableRow element if the position is in a TableRow. Otherwise, null.

Gets the current TableRowLayoutBox.

C#
public TableRowLayoutBox GetCurrentTableRowBox()
Returns:

TableRowLayoutBox

The current TableRowLayoutBox. If such cannot be found, the method returns null.

Gets the current word.

C#
public string GetCurrentWord()
Returns:

string

The current word.

Returns a hash code for this instance.

C#
public override int GetHashCode()
Returns:

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Overrides: object.GetHashCode()

Gets the index of the position in the current span.

C#
public int GetIndexInCurrentSpan()
Returns:

int

The index of the position in the current span.

Gets the index of the position in the current SpanLayoutBox.

C#
public int GetIndexInCurrentSpanBox()
Returns:

int

The index of the position in the current SpanLayoutBox.

Gets the next Inline element.

C#
public Inline GetNextInline()
Returns:

Inline

The next Inline element. If such cannot be found, the method returns null.

Gets the next InlineLayoutBox.

C#
public InlineLayoutBox GetNextInlineBox()
Returns:

InlineLayoutBox

The next InlineLayoutBox. If such cannot be found, the method returns null.

Gets the next SpanLayoutBox.

C#
public SpanLayoutBox GetNextSpanBox()
Returns:

SpanLayoutBox

The next SpanLayoutBox. If such cannot be found, the method returns null.

Gets the previous Inline.

C#
public Inline GetPreviousInline()
Returns:

Inline

The previous Inline element. If such cannot be found, the method returns null.

Gets the previous InlineLayoutBox.

C#
public InlineLayoutBox GetPreviousInlineBox()
Returns:

InlineLayoutBox

The previous InlineLayoutBox. If such cannot be found, the method returns null.

Gets the previous SpanLayoutBox.

C#
public SpanLayoutBox GetPreviousSpanBox()
Returns:

SpanLayoutBox

The previous SpanLayoutBox. If such cannot be found, the method returns null.

Moves the position down.

C#
public bool MoveDown()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the end of the current line.

C#
public bool MoveToCurrentLineEnd()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the start of the current line.

C#
public bool MoveToCurrentLineStart()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the end of the current word.

C#
public void MoveToCurrentWordEnd()

Moves the position to the start of the current word.

C#
public void MoveToCurrentWordStart()

Moves the position to the end of a document element.

C#
public void MoveToDocumentElementEnd(DocumentElement element)
Parameters:elementDocumentElement

The document element.

Moves the position to the start of a document element.

C#
public void MoveToDocumentElementStart(DocumentElement element)
Parameters:elementDocumentElement

The document element.

Moves the position to the last position in the document.

C#
public void MoveToDocumentEnd()

Moves the position to the first position in the document.

C#
public void MoveToDocumentStart()

Moves the position to the start of an Inline.

C#
public void MoveToInline(Inline inline)
Parameters:inlineInline

Moves the position to InlineLayoutBox.

C#
public void MoveToInline(InlineLayoutBox inlineLayoutBox, int index)
Parameters:inlineLayoutBoxInlineLayoutBox

The InlineLayoutBox.

indexint

The index in the InlineLayoutBox.

Moves the position to the next possible position in the document.

C#
public bool MoveToNext()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the next InlineLayoutBox.

C#
public bool MoveToNextInlineBox()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the first position on the next page.

C#
public void MoveToNextPageStart()

Moves the position to the first position in the next paragraph.

C#
public void MoveToNextParagraphStart()

Moves the position to the next SpanLayoutBox.

C#
public bool MoveToNextSpanBox()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the start of the next word.

C#
public bool MoveToNextWordStart()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the start of a page.

C#
public void MoveToPage(int pageNumber)
Parameters:pageNumberint

The number of the page the position should be moved to.

Moves the position to the last position in the current paragraph.

C#
public void MoveToParagraphEnd()

Moves the position to the first position in the current paragraph.

C#
public void MoveToParagraphStart()

Moves the position to a specific position in the document.

C#
public void MoveToPosition(DocumentPosition newPosition)
Parameters:newPositionDocumentPosition

The new position.

Moves the position to the previous possible position in the document.

C#
public bool MoveToPrevious()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the previous InlineLayoutBox.

C#
public bool MoveToPreviousInlineBox()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the last position on the previous page.

C#
public void MoveToPreviousPageEnd()

Moves the position to the last position in the previous paragraph.

C#
public void MoveToPreviousParagraphEnd()

Moves the position to the first position in the previous paragraph.

C#
public void MoveToPreviousParagraphStart()

Moves the position to the previous SpanLayoutBox.

C#
public bool MoveToPreviousSpanBox()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the start of the previous word.

C#
public bool MoveToPreviousWordStart()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position to the last position in the current table cell.

C#
public void MoveToTableCellEnd()

Moves the position to the first position in the current table cell.

C#
public void MoveToTableCellStart()

Moves the position up.

C#
public bool MoveUp()
Returns:

bool

True if the position is moved successfully. Otherwise, false.

Moves the position vertically with specified offset.

C#
public void MoveVertically(float verticalOffset)
Parameters:verticalOffsetfloat

The vertical offset.

Called after changing the location of the position.

C#
protected virtual void OnLocationChanged(bool changesCursorInitialLocation)
Parameters:changesCursorInitialLocationbool

if set to true [changes cursor initial location].

Called before changing the location of the position.

C#
protected virtual void OnLocationChanging()

Called when position is changed.

C#
protected virtual void OnPositionChanged()

Called when position is changing.

C#
protected virtual void OnPositionChanging()

Resets the position to the first position in the document.

C#
public void Reset()

Moves the position to the nearest possible to a given point.

C#
public void SetPosition(PointF point)
Parameters:pointPointF

The point.

Returns a string that represents this instance.

C#
public override string ToString()
Returns:

string

A string that represents this instance.

Overrides: object.ToString()

Events

Occurs when changing the coordinates of a position.

For the caret position, this can be also achieved by typing, using the arrows keys or by clicking somewhere in the document.

C#
public event EventHandler LocationChanged

Occurs before changing the coordinates of a position.

For the caret position, this can be also achieved by typing, using the arrows keys or by clicking somewhere in the document.

C#
public event EventHandler LocationChanging

Occurs when the position is moved.

For the caret position, this can be also achieved using the arrows keys or by clicking somewhere in the document.

C#
public event EventHandler PositionChanged

Occurs before the position is moved.

For the caret position, this can be also achieved using the arrows keys or by clicking somewhere in the document.

C#
public event EventHandler PositionChanging

Operators

Implements the operator !=.

C#
public static bool operator !=(DocumentPosition position1, DocumentPosition position2)
Parameters:position1DocumentPosition

The first position.

position2DocumentPosition

The second position.

Returns:

bool

The result of the operator.

Implements the operator <.

C#
public static bool operator <(DocumentPosition position1, DocumentPosition position2)
Parameters:position1DocumentPosition

The first position.

position2DocumentPosition

The second position.

Returns:

bool

The result of the operator.

Implements the operator <=.

C#
public static bool operator <=(DocumentPosition position1, DocumentPosition position2)
Parameters:position1DocumentPosition

The first position.

position2DocumentPosition

The second position.

Returns:

bool

The result of the operator.

Implements the operator ==.

C#
public static bool operator ==(DocumentPosition position1, DocumentPosition position2)
Parameters:position1DocumentPosition

The first position.

position2DocumentPosition

The second position.

Returns:

bool

The result of the operator.

Implements the operator >.

C#
public static bool operator >(DocumentPosition position1, DocumentPosition position2)
Parameters:position1DocumentPosition

The first position.

position2DocumentPosition

The second position.

Returns:

bool

The result of the operator.

Implements the operator >=.

C#
public static bool operator >=(DocumentPosition position1, DocumentPosition position2)
Parameters:position1DocumentPosition

The first position.

position2DocumentPosition

The second position.

Returns:

bool

The result of the operator.

In this article
DefinitionConstructorsDocumentPosition(DocumentLayoutBox, bool)DocumentPosition(DocumentLayoutBox)DocumentPosition(DocumentPosition, bool)DocumentPosition(DocumentPosition)DocumentPosition(RadDocument, bool)DocumentPosition(RadDocument)PropertiesIsPositionAtDocumentEndIsPositionAtDocumentStartIsPositionAtParagraphEndIsPositionAtParagraphStartIsPositionAtTableCellEndIsPositionAtTableCellStartIsPositionAtTableRowStartIsPositionInsideTableLocationMethodsCompareTo(DocumentPosition)Dispose()Equals(object)GetCurrentInline()GetCurrentInlineBox()GetCurrentParagraph()GetCurrentParagraphBox()GetCurrentSectionBox()GetCurrentSpan()GetCurrentSpanBox()GetCurrentTable()GetCurrentTableBox()GetCurrentTableCell()GetCurrentTableCellBox()GetCurrentTableRow()GetCurrentTableRowBox()GetCurrentWord()GetHashCode()GetIndexInCurrentSpan()GetIndexInCurrentSpanBox()GetNextInline()GetNextInlineBox()GetNextSpanBox()GetPreviousInline()GetPreviousInlineBox()GetPreviousSpanBox()MoveDown()MoveToCurrentLineEnd()MoveToCurrentLineStart()MoveToCurrentWordEnd()MoveToCurrentWordStart()MoveToDocumentElementEnd(DocumentElement)MoveToDocumentElementStart(DocumentElement)MoveToDocumentEnd()MoveToDocumentStart()MoveToInline(Inline)MoveToInline(InlineLayoutBox, int)MoveToNext()MoveToNextInlineBox()MoveToNextPageStart()MoveToNextParagraphStart()MoveToNextSpanBox()MoveToNextWordStart()MoveToPage(int)MoveToParagraphEnd()MoveToParagraphStart()MoveToPosition(DocumentPosition)MoveToPrevious()MoveToPreviousInlineBox()MoveToPreviousPageEnd()MoveToPreviousParagraphEnd()MoveToPreviousParagraphStart()MoveToPreviousSpanBox()MoveToPreviousWordStart()MoveToTableCellEnd()MoveToTableCellStart()MoveUp()MoveVertically(float)OnLocationChanged(bool)OnLocationChanging()OnPositionChanged()OnPositionChanging()Reset()SetPosition(PointF)ToString()EventsLocationChangedLocationChangingPositionChangedPositionChangingOperatorsoperator !=(DocumentPosition, DocumentPosition)operator <(DocumentPosition, DocumentPosition)operator <=(DocumentPosition, DocumentPosition)operator ==(DocumentPosition, DocumentPosition)operator >(DocumentPosition, DocumentPosition)operator >=(DocumentPosition, DocumentPosition)
Not finding the help you need?
Contact Support