A modern, feature-rich replacement for the traditional RichTextBox control in Windows Forms applications. RichEditor.NET leverages the Windows Text Object Model 2 (TOM2) via the RichEdit 4.1 control (msftedit.dll) to provide advanced text and image formatting, built-in spell checking, a context-menu popup toolbar, and first-class HTML and Markdown serialization.
- Bold / Italic / Strikethrough
- Underline with multiple styles: Single, Double, Dotted, Dashed, and Wavy
- Font color and background (highlight) color
- Font name and font size (free-form or HTML heading sizes)
- Superscript and Subscript
- Block styles: Paragraph, Heading 1-6, and Preformatted
- Paragraph alignment: Left, Center, Right, and Justify
- Indentation: Indent and Outdent with configurable point increments
- Lists with multiple styles:
- Bullet (unordered)
- Decimal, Lower Alpha, Upper Alpha, Lower Roman, Upper Roman (ordered)
- Nested list levels with increase/decrease support
- Embedded images: Insert JPEG, PNG, or GIF images directly into the document
- Linked thumbnails: Insert a downsampled thumbnail that links to the original full-size image URL
- Alt text support for inserted images
- Configurable default image dimensions (
DefaultImageWidth/DefaultImageHeight)
- HTML: Read and write document content as HTML with full round-trip support for all formatting features. Optionally enable strict mode (
EnableStrictHtml) to throw on unsupported tags. - Markdown: Read and write CommonMark or GitHub Flavored Markdown (GFM) via the
EnableCommonMarkdownandEnableGithubMarkdownproperties.
- Built-in spell checking via the Windows system spell checker
- Popup toolbar that appears on right-click with formatting controls
- Hyperlink insertion with custom display text
- Per-feature enable/disable properties for fine-grained control over available formatting options
- Events for hyperlink, image, and linked thumbnail insertion via the popup toolbar
- Windows 8 or later (for spell checking and TOM2 support)
- .NET 8+ or .NET Framework 4.8
Install via the .NET CLI:
dotnet add package EllipticBit.RichEditorNET
Or via the Package Manager Console in Visual Studio:
Install-Package EllipticBit.RichEditorNET
Drop a RichEditBox onto your form or create one in code:
using EllipticBit.RichEditorNET;
var editor = new RichEditBox
{
Dock = DockStyle.Fill,
EnableSpellCheck = true,
};
this.Controls.Add(editor);// Toggle bold on the current selection
editor.ToggleBold();
// Toggle italic
editor.ToggleItalic();
// Apply a wavy underline
editor.ToggleUnderline(UnderlineStyle.Wavy);
// Set font color to red
editor.SetFontColor(Color.Red);
// Set background highlight to yellow
editor.SetBackgroundColor(Color.Yellow);
// Change font name and size
editor.SetFontName("Georgia");
editor.SetFontSize(14f);// Apply Heading 1 block style (requires EnableHtmlFontSizing = true)
editor.EnableHtmlFontSizing = true;
editor.SetBlockStyle(BlockStyle.Heading1);
// Toggle a bullet list
editor.ToggleList(ListStyle.Bullet);
// Increase nesting level
editor.IncreaseListLevel();
// Set paragraph alignment to center
editor.SetAlignment(ParagraphAlignment.Center);editor.InsertHyperlink("https://github.com", "Visit GitHub");// Insert an embedded image from a file
using (var stream = File.OpenRead("photo.png"))
{
editor.InsertImage(stream, "A sample photo");
}
// Insert a linked thumbnail that opens the full image URL
using (var stream = File.OpenRead("photo.png"))
{
editor.InsertLinkedThumbnail(
"https://example.com/photo-full.png",
stream,
"Thumbnail preview");
}// Load HTML content
editor.Html = "<p>Hello <b>World</b></p>";
// Retrieve the document as HTML
string html = editor.Html;// Enable GitHub Flavored Markdown
editor.EnableGithubMarkdown = true;
// Load Markdown
editor.Markdown = "# Hello\n\nThis is **bold** and ~~strikethrough~~ text.";
// Retrieve the document as Markdown
string md = editor.Markdown;When EnableCommonMarkdown or EnableGithubMarkdown is set to true, formatting options that are not representable in the target Markdown flavor are automatically disabled. This ensures the content stays portable.
| Property | Type | Default | Description |
|---|---|---|---|
EnableSpellCheck |
bool |
true |
Enables the system spell checker |
EnableBold |
bool |
true |
Enables bold formatting |
EnableItalic |
bool |
true |
Enables italic formatting |
EnableUnderline |
bool |
true |
Enables underline formatting |
EnableStrikeThrough |
bool |
true |
Enables strikethrough formatting |
EnableFontColor |
bool |
true |
Enables font color formatting |
EnableBackgroundColor |
bool |
true |
Enables background color formatting |
EnableFontName |
bool |
true |
Enables font name formatting |
EnableFontSize |
bool |
true |
Enables font size formatting |
EnableSuperscript |
bool |
true |
Enables superscript formatting |
EnableSubscript |
bool |
true |
Enables subscript formatting |
EnableLists |
bool |
true |
Enables list formatting |
EnableAlignment |
bool |
true |
Enables paragraph alignment |
EnableIndent |
bool |
true |
Enables paragraph indentation |
EnableHtmlFontSizing |
bool |
false |
Uses HTML heading sizes instead of free-form font size/name |
EnableHyperlinks |
bool |
true |
Enables hyperlink insertion |
EnableImages |
bool |
true |
Enables image insertion |
EnableCommonMarkdown |
bool |
false |
Enables CommonMark Markdown mode |
EnableGithubMarkdown |
bool |
false |
Enables GitHub Flavored Markdown mode |
EnableStrictHtml |
bool |
false |
Throws on unsupported HTML tags/attributes when loading HTML |
DefaultImageWidth |
int |
320 |
Default display width in pixels for inserted images |
DefaultImageHeight |
int |
240 |
Default display height in pixels for inserted images |
Html |
string |
- | Gets or sets document content as HTML |
Markdown |
string |
- | Gets or sets document content as Markdown |
| Event | Description |
|---|---|
InsertHyperlinkClicked |
Raised when the Insert Hyperlink button is clicked on the popup toolbar |
InsertImageClicked |
Raised when the Insert Image button is clicked on the popup toolbar |
InsertLinkedThumbnailClicked |
Raised when the Insert Linked Thumbnail button is clicked on the popup toolbar |
Contributions are welcome! To get started:
- Fork this repository and create a feature branch from
master. - Make your changes and ensure the project builds successfully for both
net8.0-windowsandnet48targets. - Add or update tests as appropriate.
- Submit a Pull Request with a clear description of what you changed and why.
- Follow the existing code style and conventions in the repository.
- Use the latest C# language features where appropriate.
- Ensure all COM objects are properly released via
Marshal.ReleaseComObject.
If any part of your contribution was generated with the assistance of a Large Language Model (LLM) such as ChatGPT, GitHub Copilot, Claude, or similar tools, you must include the full prompt(s) used to generate the contribution in the Pull Request description. This is required for transparency and review purposes.
Please use GitHub Issues to report bugs or request features. Include steps to reproduce the problem and, if possible, a minimal code sample.
This project is licensed under the Boost Software License 1.0 (BSL-1.0).
Copyright (c) EllipticBit LLC 2026