Table of Contents

Class RichTextBox

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Implements rich text editor functionality.

[ControlCategory("Common")]
public class RichTextBox : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo, IReadOnlyStrings, IRichTextBox, ISimpleRichTextBox
Inheritance
RichTextBox
Implements

Examples

Here is how to declare a RichTextBox in UIXML:

<RichTextBox Name="richTextBox1" Dock="Fill" HasBorder="false"/>

Also, a RichTextBox can be created from code:

RichTextBox result = new()
{
    HasBorder = false,
    MinimumSize = (200, 50),
    Dock = DockStyle.Bottom,
    Parent = mainPanel,
    Text = "Bottom",
};

Here is the code to init some text with formatting in the control:

public void InitRichEdit()
{
    var baseFontSize = (int)Control.DefaultFont.SizeInPoints;

    const string itWasInJanuary =
        "It was in January, the most down-trodden month of an Edinburgh winter." +
        " An attractive woman came into the cafe, which is nothing remarkable.";

    var r = richTextBox1;

    r.SetDefaultStyle(r.CreateTextAttr());

    r.BeginUpdate();
    r.BeginSuppressUndo();

    r.BeginParagraphSpacing(0, 20);
    r.BeginAlignment(TextBoxTextAttrAlignment.Center);
    r.BeginBold();

    r.BeginFontSize(baseFontSize + 5);

    r.WriteText("Welcome to RichTextBox, a control");
    r.LineBreak();
    r.WriteText("for editing and presenting styled text and images\n");
    r.EndFontSize();

    r.EndBold();
    r.NewLine();

    var logoImage = Alternet.Drawing.Image.FromUrl("embres:Examples.RichTextBox.icon-48x48.png");

    r.WriteImage(logoImage);

    r.NewLine();

    r.EndAlignment();

    r.NewLine();

    r.WriteText("What can you do with this thing? ");

    r.WriteImageAsNormal(KnownSvgImages.ImgMessageBoxInformation, 24);

    r.WriteText(" Well, you can change text ");

    r.BeginTextColor(Alternet.Drawing.Color.Red);
    r.WriteText("color, like this red bit. ");
    r.EndTextColor();

    var backgroundColourAttr = r.CreateRichAttr();
    backgroundColourAttr.SetBackgroundColor(Alternet.Drawing.Color.Green);
    backgroundColourAttr.SetTextColor(Alternet.Drawing.Color.Yellow);
    r.BeginStyle(backgroundColourAttr);
    r.WriteText("And this yellow on green bit");
    r.EndStyle();

    r.WriteText(". Naturally you can make things ");
    r.BeginBold();
    r.WriteText("bold ");
    r.EndBold();
    r.BeginItalic();
    r.WriteText("or italic ");
    r.EndItalic();
    r.BeginUnderline();
    r.WriteText("or underlined.");
    r.EndUnderline();

    r.BeginFontSize(baseFontSize + 3);
    r.WriteText(" Different font sizes on the same line is allowed, too.");
    r.EndFontSize();

    r.WriteText(" Next we'll show an indented paragraph.");

    r.NewLine();

    r.BeginLeftIndent(60);
    r.WriteText(itWasInJanuary);
    r.NewLine();

    r.EndLeftIndent();

    r.WriteText(
        "Next, we'll show a first-line indent, achieved using BeginLeftIndent(100, -40).");

    r.NewLine();

    r.BeginLeftIndent(100, -40);

    r.WriteText(itWasInJanuary);
    r.NewLine();

    r.EndLeftIndent();

    r.WriteText("Numbered bullets are possible, again using subindents:");
    r.NewLine();

    r.BeginNumberedBullet(1, 100, 60);
    r.WriteText("This is my first item. Note that RichTextBox can apply" +
        " numbering and bullets automatically based on list styles, but this" +
        " list is formatted explicitly by setting indents.");
    r.NewLine();
    r.EndNumberedBullet();

    r.BeginNumberedBullet(2, 100, 60);
    r.WriteText("This is my second item.");
    r.NewLine();
    r.EndNumberedBullet();

    r.WriteText("The following paragraph is right-indented:");
    r.NewLine();

    r.BeginRightIndent(200);

    r.WriteText(itWasInJanuary);
    r.NewLine();

    r.EndRightIndent();

    r.WriteText("The following paragraph is right-aligned with 1.5 line spacing:");
    r.NewLine();

    r.BeginAlignment(TextBoxTextAttrAlignment.Right);
    r.BeginLineSpacing((int)TextBoxTextAttrLineSpacing.Half);
    r.WriteText(itWasInJanuary);
    r.NewLine();
    r.EndLineSpacing();
    r.EndAlignment();

    r.WriteText("Other notable features of RichTextBox include:");
    r.NewLine();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText("Compatibility with TextBox API.");
    r.NewLine();
    r.EndSymbolBullet();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText(
        "Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle().");
    r.NewLine();
    r.EndSymbolBullet();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText("XML and other formats loading and saving.");
    r.NewLine();
    r.EndSymbolBullet();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText("Undo/Redo, with batching option and Undo suppressing.");
    r.NewLine();
    r.EndSymbolBullet();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText("Clipboard copy and paste.");
    r.NewLine();
    r.EndSymbolBullet();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText("Style sheets with named character and paragraph styles," +
        " and control for applying named styles.");
    r.NewLine();
    r.EndSymbolBullet();

    r.BeginSymbolBullet("*", 100, 60);
    r.WriteText("A design that can easily be extended to other content types," +
        " ultimately with text boxes, tables, controls, and so on.");
    r.NewLine();
    r.EndSymbolBullet();

    // Make a style suitable for showing a URL
    var urlStyle = r.CreateUrlAttr();

    r.WriteText("RichTextBox can also display URLs, such as this one: ");
    r.BeginStyle(urlStyle);
    r.BeginURL("http://www.alternet-ui.com");
    r.WriteText("Alternet UI Web Site");
    r.EndURL();
    r.EndStyle();
    r.WriteText(". Click on the URL to generate an event.");

    r.NewLine();

    r.WriteText("Note: this sample content was generated programmatically" +
        " from within the demo. The images were loaded from resources. Enjoy RichTextBox!\n");

    r.NewLine();

    static string St(KeyInfo[] keys)
    {
        var filteredKeys = KeyInfo.FilterBackendOs(keys);

        return StringUtils.ToString(
                        filteredKeys,
                        string.Empty,
                        string.Empty,
                        " or ");
    }

    r.WriteText("Keys:\n");

    r.WriteText($"{St(KnownShortcuts.RichEditKeys.ToggleBold)} - Toggle Bold style.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.ToggleItalic)} - Toggle Italic style.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.ToggleUnderline)} - Toggle Underline style.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.ToggleStrikethrough)} - Toggle Strikethrough style.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.LeftAlign)} - Left Align\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.CenterAlign)} - Center Align.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.RightAlign)} - Right Align.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.Justify)} - Justify.\n");
    r.WriteText($"{St(KnownShortcuts.RichEditKeys.ClearTextFormatting)} - Clear formatting.\n");

    r.EndParagraphSpacing();
    r.EndSuppressUndo();
    r.EndUpdate();
}

Remarks

Example of how a RichTextBox can look:

RichTextBox

Constructors

RichTextBox()

Initializes a new instance of the RichTextBox class.

Properties

AllowAdditionalKeys

Gets or sets whether to call HandleAdditionalKeys(KeyEventArgs) method when key is pressed. Default is true.

AutoUrlModifiers

Gets or sets ModifierKeys used when clicked url is autoimatically opened in the browser when AutoUrlOpen is true.

AutoUrlOpen

Gets or sets a value indicating whether urls in the input text are opened in the default browser.

ControlKind

Returns control identifier.

CurrentPosition

Gets or sets current position of the caret.

DefaultUrlColorOnBlack

Gets or sets default url color for the dark color scheme. This color looks good on dark background. This property was added for the convenience and currently is used only CreateUrlAttr().

DefaultUrlColorOnWhite

Gets or sets default url color. This color looks good on white background. This property was added for the convenience and currently is used only CreateUrlAttr().

FileName

Gets or sets the current filename associated with the control.

HasBorder

Gets or sets a value indicating whether the control has a border.

InsertionPointLineNumber

Gets the line number (zero-based) with the cursor.

LastLineNumber

Gets the last line number (zero-based).

ReadOnly

Gets or sets a value indicating whether text in the control is read-only.

ReportedPosition

Gets or sets position of the caret which was reported in the event.

Search

Gets or sets string search provider.

Text

Gets or sets the text contents of the control.

Methods

AppendText(string)

Sets the insertion point to the end of the buffer and writes the text.

AppendTextAndStyles(IEnumerable<object>)

Appends text and styles to the end of the text control.

ApplyAlignmentToSelection(TextBoxTextAttrAlignment)

Applies the given alignment to the selection or the default style (undoable).

ApplyBoldToSelection()

Apples bold to the selection or default style (undoable).

ApplyItalicToSelection()

Applies italic to the selection or default style (undoable).

ApplyStyleToSelection(ITextBoxRichAttr, RichTextSetStyleFlags)

Sets specified style to the selection.

ApplyTextEffectToSelection(TextBoxTextAttrEffects)

Applies one or more TextBoxTextAttrEffects flags to the selection (undoable). If there is no selection, it is applied to the default style.

ApplyUnderlineToSelection()

Applies underline to the selection or default style (undoable).

BatchingUndo()

Returns true if undo commands are being batched.

BeginAlignment(TextBoxTextAttrAlignment)

Begins using alignment.

BeginBatchUndo(string)

Starts batching undo history for commands.

BeginBold()

Begins using bold.

BeginCharacterStyle(string)

Begins using the named character style.

BeginFont(Font?)

Begins using this font.

BeginFontSize(double)

Begins using the given point size.

BeginFontSize(int)

Begins using the given point size.

BeginItalic()

Begins using italic.

BeginLeftIndent(int, int)

Begins applying a left indent and subindent in tenths of a millimetre.

BeginLineSpacing(int)

Begins applying line spacing.

BeginListStyle(string, int, int)

Begins using a specified list style. Optionally, you can also pass a level and a number.

BeginNumberedBullet(int, int, int, TextBoxTextAttrBulletStyle)

Begins a numbered bullet.

BeginParagraphSpacing(int, int)

Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.

BeginParagraphStyle(string)

Begins applying the named paragraph style.

BeginRightIndent(int)

Begins a right indent, specified in tenths of a millimetre.

BeginStandardBullet(string, int, int, TextBoxTextAttrBulletStyle)

Begins applying a symbol bullet.

BeginStyle(ITextBoxRichAttr)

Begins applying a style.

BeginSuppressUndo()

Starts suppressing undo history for commands.

BeginSymbolBullet(string, int, int, TextBoxTextAttrBulletStyle)

Begins applying a symbol bullet, using a character from the current font. See BeginNumberedBullet(int, int, int, TextBoxTextAttrBulletStyle) for an explanation of how indentation is used to render the bulleted paragraph.

BeginTextColor(Color)

Begins using this color.

BeginURL(string, string?)

Begins applying Url to the content. Pass a URL and optionally, a character style to apply, since it is common to mark a URL with a familiar style such as blue text with underlining.

BeginUnderline()

Begins using underlining.

CanCopy()

Returns true if selected content can be copied to the clipboard.

CanCut()

Returns true if selected content can be copied to the clipboard and deleted.

CanDeleteSelection()

Returns true if selected content can be deleted.

CanPaste()

Returns true if the clipboard content can be pasted to the buffer.

CanRedo()

Returns true if there is a command in the command history that can be redone.

CanUndo()

Returns true if there is a command in the command history that can be undone.

Clear()

Clears the buffer content, leaving a single empty paragraph. Cannot be undone.

ClearListStyle(long, long, RichTextSetStyleFlags)

Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.

Copy()

Copies the selected content (if any) to the clipboard.

CreateHandler()

Creates a handler for the control.

CreateRichAttr()

Creates new custom rich text style.

CreateTextAttr()

Creates text attributes object.

CreateUrlAttr()

Creates default style for the urls.

Cut()

Copies the selected content (if any) to the clipboard and deletes the selection. This is undoable.

Delete(long, long)

Deletes the content within the given range.

DeleteSelectedContent()

Deletes content if there is a selection, e.g. when pressing a key. Returns the new caret position in @e newPos, or leaves it if there was no action. This is undoable.

DeleteSelection()

Deletes the content in the selection, if any. This is undoable.

DiscardEdits()

Sets the buffer's modified status to false, and clears the buffer's command history.

DoWriteText(string, TextBoxSetValueFlags)

Writes text.

DoesSelectionHaveTextEffectFlag(TextBoxTextAttrEffects)

Returns true if all of the selection, or the content at the current caret position, has the supplied effects flag(s).

EnableDelayedImageLoading(bool)

Enable or disable delayed image loading.

EnableImages(bool)

Enable or disable images.

EnableVerticalScrollbar(bool)

Enable or disable the vertical scrollbar.

EnableVirtualAttributes(bool)

Pass true to let the control use attributes. The default is false.

EndAlignment()

Ends alignment.

EndAllStyles()

Ends application of all styles in the current style stack.

EndBatchUndo()

Ends batching undo command history.

EndBold()

Ends using bold.

EndCharacterStyle()

Ends application of a named character style.

EndFont()

Ends using a font.

EndFontSize()

Ends using a point size.

EndItalic()

Ends using italic.

EndLeftIndent()

Ends left indent.

EndLineSpacing()

Ends line spacing.

EndListStyle()

Ends using a specified list style.

EndNumberedBullet()

Ends application of a numbered bullet.

EndParagraphSpacing()

Ends paragraph spacing.

EndParagraphStyle()

Ends application of a named paragraph style.

EndRightIndent()

Ends right indent.

EndStandardBullet()

Begins applying a standard bullet.

EndStyle()

Ends the current style.

EndSuppressUndo()

Ends suppressing undo command history.

EndSymbolBullet()

Ends applying a symbol bullet.

EndTextColor()

Ends applying a text color.

EndURL()

Ends applying a URL.

EndUnderline()

End applying underlining.

ExtendSelection(long, long, RichTextMoveCaretFlags)

Helper function for extending the selection, returning true if the selection was changed. Selections are in caret positions.

FindNextWordPosition(int)

Helper function for finding the caret position for the next word. Direction is 1 (forward) or -1 (backwards).

ForceDelayedLayout()

Forces any pending layout due to delayed, partial layout when the control was resized.

GetAdjustedCaretPosition(long)

Gets the adjusted caret position.

GetBasicStyle()

Gets the basic (overall) style.

GetCaretAtLineStart()

Returns true if we are showing the caret position at the start of a line instead of at the end of the previous one.

GetCaretPosition()

Returns the current caret position.

GetCaretPositionForDefaultStyle()

Returns the caret position since the default formatting was changed. As soon as this position changes, we no longer reflect the default style in the UI. A value of -2 means that we should only reflect the style of the content under the caret.

GetDefaultStyleEx()

Returns the current default style, which can be used to change how subsequently inserted text is displayed.

GetDelayedImageLoading()

Returns true if delayed image loading is enabled.

GetDelayedImageProcessingRequired()

Gets the flag indicating that delayed image processing is required.

GetDelayedImageProcessingTime()

Returns the last time delayed image processing was performed.

GetDelayedLayoutThreshold()

Gets the size of the buffer beyond which layout is delayed during resizing. This optimizes sizing for large buffers. The default is 20000.

GetDragging()

Returns true if we are dragging a selection.

GetFileHandlerFlags()

Returns flags that change the behaviour of loading or saving. See the documentation for each handler class to see what flags are relevant for each handler.

GetFileName()

Gets name of the file loaded into the control.

GetFirstVisiblePoint()

Returns the first visible point in the control.

GetFirstVisiblePosition()

Returns the first visible position in the current view.

GetFontScale()

Returns the scale factor for displaying fonts, for example for more comfortable editing.

GetFullLayoutRequired()

Gets the flag indicating that full layout is required.

GetFullLayoutSavedPosition()

Returns the position that should be shown when full (delayed) layout is performed.

GetFullLayoutTime()

Returns the last time full layout was performed.

GetImagesEnabled()

Returns true if images are enabled.

GetInsertionPoint()

Returns the current insertion point.

GetLastPosition()

Returns the last position in the buffer.

GetLineHeight()

Gets the line increment height in pixels.

GetLineLength(long)

Returns the length of the specified line in characters.

GetLineText(long)

Returns the text for the given line.

GetLogicalPoint(PointI)

Transforms physical window position to logical (unscrolled) position.

GetNumberOfLines()

Returns the number of lines in the buffer.

GetPhysicalPoint(PointI)

Transforms logical (unscrolled) position to physical window position.

GetRange(long, long)

Returns the string containing the text starting in the positions from and up to to in the control.

GetRichStyle(long)

Gets the attributes at the given position.

GetRichStyleForRange(long, long)

Gets the attributes common to the specified range. Attributes that differ in value within the range will not be included in style flags.

GetSelectionAnchor()

Returns an anchor so we know how to extend the selection. It's a caret position since it's between two characters.

GetStringSelection()

Returns the text within the current selection range, if any.

GetStyle(long)

Gets the attributes at the given position.

GetStyleForRange(long, long)

Gets the attributes common to the specified range. Attributes that differ in value within the range will not be included in style flags.

GetTextCursor()

Returns the text (normal) cursor.

GetURLCursor()

Returns the cursor to be used over URLs.

GetValue()

Returns the content of the entire control as a string.

GetVerticalScrollbarEnabled()

Returns true if the vertical scrollbar is enabled.

GetVirtualAttributesEnabled()

Returns true if this control can use attributes and text. The default is false.

HandleAdditionalKeys(KeyEventArgs)

Handles additional rich text editor keys like Ctrl+B, Ctrl+I, Ctrl+U and other.

HasParagraphAttributes(long, long, ITextBoxRichAttr)

Test if this whole range has paragraph attributes of the specified kind.

HasSelection()

Returns true if there is a selection and the object containing the selection was the same as the current focus object.

HasUnfocusedSelection()

Returns true if there was a selection, whether or not the current focus object is the same as the selection's container object.

IdleAction()

Call this method in Idle event handler in order to update information related to the current selection and caret position.

IsDefaultStyleShowing()

Returns true if the user has recently set the default style without moving the caret, and therefore the UI needs to reflect the default style and not the style at the caret.

IsEditable()

Returns true if the control is editable.

IsModified()

Returns true if the buffer has been modified.

IsMultiLine()

Returns true if the control is multiline.

IsPositionVisible(long)

Returns true if the given position is visible on the screen.

IsSelectionAligned(TextBoxTextAttrAlignment)

Returns true if all of the selection, or the content at the caret position, is aligned according to the specified flag.

IsSelectionBold()

Returns true if all of the selection, or the content at the caret position, is bold.

IsSelectionItalics()

Returns true if all of the selection, or the content at the caret position, is italic.

IsSelectionUnderlined()

Returns true if all of the selection, or the content at the caret position, is underlined.

IsSingleLine()

Returns true if the control is single-line. Currently RichTextBox does not support single-line editing.

LayoutContent(bool)

Lays out the buffer, which must be done before certain operations, such as setting the caret position. This function should not normally be required by the application.

LineBreak()

Inserts a line break at the current insertion point. A line break forces wrapping within a paragraph, and can be introduced by using this function or by typing Shift-Return.

LoadFromFile(string, RichTextFileType)

Loads content into the control's buffer using the given type.

LoadFromStream(Stream, RichTextFileType)

Loads the buffer content from Stream using the given data type.

MarkDirty()

Marks the buffer as modified.

MoveCaretBack(long)

Move the caret one visual step forward: this may mean setting a flag and keeping the same position if we're going from the end of one line to the start of the next, which may be the exact same caret position.

MoveCaretForward(long)

Move the caret one visual step forward: this may mean setting a flag and keeping the same position if we're going from the end of one line to the start of the next, which may be the exact same caret position.

MoveDown(int, RichTextMoveCaretFlags)

Moves the caret down.

MoveEnd(RichTextMoveCaretFlags)

Moves to the end of the buffer.

MoveHome(RichTextMoveCaretFlags)

Moves to the start of the buffer.

MoveLeft(int, RichTextMoveCaretFlags)

Moves left.

MoveRight(int, RichTextMoveCaretFlags)

Moves right.

MoveToLineEnd(RichTextMoveCaretFlags)

Moves to the end of the line.

MoveToLineStart(RichTextMoveCaretFlags)

Moves to the start of the line.

MoveToParagraphEnd(RichTextMoveCaretFlags)

Moves to the end of the paragraph.

MoveToParagraphStart(RichTextMoveCaretFlags)

Moves to the start of the paragraph.

MoveUp(int, RichTextMoveCaretFlags)

Moves to the start of the paragraph.

NewLine()

Inserts new paragraphs at the current insertion point. See LineBreak().

NewLine(int)

Inserts a new paragraph at the current insertion point. See LineBreak().

NumberList(long, long, string, RichTextSetStyleFlags, int, int)

Numbers the paragraphs in the given range.

OnEnterPressed()

Raises the EnterPressed event.

OnKeyDown(KeyEventArgs)

Called when the KeyDown event is raised.

OnTextUrl(UrlEventArgs)

Raises the TextUrl event.

PageDown(int, RichTextMoveCaretFlags)

Moves one or more pages down.

PageUp(int, RichTextMoveCaretFlags)

Moves one or more pages up.

Paste()

Pastes content from the clipboard to the buffer.

PositionToXY(long)

Converts a text position to zero-based column and line numbers.

ProcessDelayedImageLoading(bool)

Does delayed image loading and garbage-collect other images.

PromoteList(int, long, long, string, RichTextSetStyleFlags, int)

Promotes or demotes the paragraphs in the given range.

Redo()

Redoes the current command.

Remove(long, long)

Removes the content in the specified range.

Replace(long, long, string)

Replaces the content in the specified range with the string specified by @a value.

RequestDelayedImageProcessing()

Requests delayed image processing.

SaveToFile(string, RichTextFileType)

Saves the buffer content using the given type.

SaveToStream(Stream, RichTextFileType)

Saves the buffer content to Stream using the given data type.

SelectNone()

Cancels any selection.

SelectWord(long)

Selects the word at the given character position.

SelectionAlignCenter()

Sets text alignment in the current position to Center

SelectionAlignJustified()

Sets text alignment in the current position to Justified

SelectionAlignLeft()

Sets text alignment in the current position to Left

SelectionAlignRight()

Sets text alignment in the current position to Right

SelectionClearFormatting()

Clears formatting of the selection.

SelectionToggleBold()

Toggles Bold style of the selection.

SelectionToggleItalic()

Toggles Italic style of the selection.

SelectionToggleStrikethrough()

Toggles Strikeout style of the selection.

SelectionToggleUnderlined()

Toggles Underline style of the selection.

SetAndShowDefaultStyle(ITextBoxRichAttr)

Sets attr as the default style and tells the control that the UI should reflect this attribute until the user moves the caret.

SetBasicStyle(ITextBoxRichAttr)

Sets the basic (overall) style.

SetCaretAtLineStart(bool)

Sets a flag to remember that we are showing the caret position at the start of a line instead of at the end of the previous one.

SetCaretPosition(long, bool)

Sets the caret position.

SetCaretPositionForDefaultStyle(long)

Set the caret position for the default style that the user is selecting.

SetDefaultRichStyle(ITextBoxRichAttr)

Sets the current default style, which can be used to change how subsequently inserted text is displayed.

SetDefaultStyle(ITextBoxTextAttr)

Sets the current default style, which can be used to change how subsequently inserted text is displayed.

SetDefaultStyleToCursorStyle()

Sets the default style to the style under the cursor.

SetDelayedImageProcessingRequired(bool)

Sets the flag indicating that delayed image processing is required.

SetDelayedImageProcessingTime(long)

Sets the last time delayed image processing was performed.

SetDelayedLayoutThreshold(long)

Sets the size of the buffer beyond which layout is delayed during resizing. This optimizes sizing for large buffers. The default is 20000.

SetDragging(bool)

Sets a flag to remember if we are dragging a selection.

SetEditable(bool)

Makes the control editable, or not.

SetFileHandlerFlags(RichTextHandlerFlags, int)

Sets flags that change the behaviour of loading or saving. See the documentation for each handler class to see what flags are relevant for each handler.

SetFileName(string)

Sets name of the file loaded into the control.

SetFontScale(double, bool)

Sets the scale factor for displaying fonts, for example for more comfortableediting.

SetFullLayoutRequired(bool)

Sets the flag indicating that full layout is required.

SetFullLayoutSavedPosition(long)

Sets the position that should be shown when full (delayed) layout is performed.

SetFullLayoutTime(long)

Sets the last time full layout was performed.

SetInsertionPoint(long)

Sets the insertion point and causes the current editing style to be taken from the new position (unlike SetCaretPosition(long, bool)).

SetInsertionPointEnd()

Sets the insertion point to the end of the text control.

SetLineHeight(int)

Sets the line increment height in pixels.

SetListStyle(long, long, string, RichTextSetStyleFlags, int, int)

Sets the list attributes for the given range, passing flags to determine how the attributes are set.

SetMaxLength(ulong)

Sets the maximum number of characters that may be entered in a single line text control. For compatibility only; currently does nothing.

SetRichStyle(long, long, ITextBoxRichAttr)

Sets the attributes for the given range.

SetSelection(long, long)

Sets the selection to the given range. The end point of range is specified as the last character position of the span of text, plus one. So, for example, to set the selection for a character at position 5, use the range (5,6).

SetSelectionAnchor(long)

Sets an anchor so we know how to extend the selection. It's a caret position since it's between two characters.

SetSelectionRange(long, long)

Sets the selection to the given range. The end point of range is specified as the last character position of the span of text, plus one. So, for example, to set the selection for a character at position 5, use the range (5,6).

SetStyle(long, long, ITextBoxTextAttr)

Sets the attributes for the given range.

SetStyleEx(long, long, ITextBoxRichAttr, RichTextSetStyleFlags)

Sets the attributes for the given range, passing flags to determine how the attributes are set.

SetTextCursor(Cursor?)

Sets the text (normal) cursor.

SetURLCursor(Cursor?)

Sets the cursor to be used over URLs.

SetValue(string)

Replaces existing content with the given text.

ShowDialogGoToLine()

Shows 'Go To Line' dialog.

ShowPosition(long)

Scrolls the buffer so that the given position is in view.

SuppressingUndo()

Returns true if undo history suppression is on.

Undo()

Undoes the command at the top of the command history, if there is one.

WordLeft(int, RichTextMoveCaretFlags)

Moves a number of words to the left.

WordRight(int, RichTextMoveCaretFlags)

Move a number of words to the right.

WriteImage(Image?, BitmapType, ITextBoxRichAttr?)

Writes a bitmap at the current insertion point. Supply an optional type to use for internal and file storage of the raw data.

WriteImage(string, BitmapType, ITextBoxRichAttr?)

Loads an image from a file and writes it at the current insertion point.

WriteImageAsNormal(SvgImage?, int, ITextBoxRichAttr?)

Writes svg image in the normal state at the current insertion point.

WriteTable(int, int, ITextBoxRichAttr?, ITextBoxRichAttr?)

Write a table at the current insertion point, returning the table.

WriteText(string)

Writes text at the current position.

WriteUrl(ITextBoxRichAttr, string, string?)

Writes url with title and style.

XYToPosition(long, long)

Translates from column and line number to position.

Events

CurrentPositionChanged

Occurs when CurrentPosition property value changes.

EnterPressed

Occurs when Enter key is pressed in the control.

TextUrl

Occurs when url clicked in the text.