C# | Visual Basic | Visual C++ |
public interface ITextAnchor
Public Interface ITextAnchor
public interface class ITextAnchor
All Members | Properties | Events | |||
Icon | Member | Description |
---|---|---|
Column |
Gets the column number of this anchor.
| |
Deleted |
Occurs after the anchor was deleted.
| |
IsDeleted |
Gets whether the anchor was deleted.
| |
Line |
Gets the line number of the anchor.
| |
Location |
Gets the text location of this anchor.
| |
MovementType |
Controls how the anchor moves.
| |
Offset |
Gets the offset of the text anchor.
| |
SurviveDeletion | Specifies whether the anchor survives deletion of the text containing it. false: The anchor is deleted when the a selection that includes the anchor is deleted. true: The anchor is not deleted. |
Use the Offset property to get the offset from a text anchor. Use the CreateAnchor(Int32) method to create an anchor from an offset.
The document will automatically update all text anchors; and because it uses weak references to do so, the garbage collector can simply collect the anchor object when you don't need it anymore.
Moreover, the document is able to efficiently update a large number of anchors without having to look at each anchor object individually. Updating the offsets of all anchors usually only takes time logarithmic to the number of anchors. Retrieving the Offset property also runs in O(lg N).
Copy | |
---|---|
TextAnchor anchor = document.CreateAnchor(offset);
ChangeMyDocument();
int newOffset = anchor.Offset; |
Assembly: ICSharpCode.AvalonEdit (Module: ICSharpCode.AvalonEdit.dll) Version: 5.0.0.4238