WinForms HTML Editor

The purpose of the Html Editor is to provide Html Editing capabilities within a WinForms control. The control should emulate the operations that are available within a Rich Text control, but have information persisted and restored from an Html BODY element.Html Editor Goals The

C# (162.3 KB)
4.9 Star
54,019 times
Add to favorites
E-mail Twitter Digg Facebook
  • Access Denied Error
    1 Posts | Last post June 06, 2019
    • Getting the below error when i try to set the BodyHTML property. Can you please advise?
      System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
         at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
         at mshtml.DispHTMLBody.set_contentEditable(String value)
  • How to handle 'Tab' key in the editor?
    1 Posts | Last post February 21, 2019
    • If we press 'Tab' in the editor, then focus shift to other control.
      How to handle 'Tab' key (tabbing) in the editor?
      Thanks in advance!!!
  • How to handle Enter key if the control is placed in a form with default accept button?
    1 Posts | Last post February 21, 2019
    • If form has default accept button, then 'Enter' key for multi line text is not working.
      Workaround is to set and reset accept button on Enter and Leave of this control.
      Just wanted to know if there is any better solution to it?
      Thanks in advance!!
  • ShortcutKey on Visual Studio 2017
    1 Posts | Last post February 08, 2019
    • Hi and htanks a lot for this material.
      I tried to compile the solution under Visual Studio 2017 and .Net Framework V4 but it displayed an error in the HtmlEditorControl.resx file at line 550.
      I changed the line 
      and it works fine.
      Thanks again.
  • HTML view while assiging string
    2 Posts | Last post December 19, 2018
    • Thanks for the control. 
      Is there a way I can assign HTML as string to the control and view the contents in HTML view. For example, when I assign "<b>hello</b>" to the control, I see it as text. In my case I would like to see it in "HTML" view and not as text.
      htmlEditorControl.InnerHtml= HTMLasStr;
      May be I ma missing a property
      Thanks for looking into it.
    • Sorry, I used the 'BodyHtml' Property and it is working as expected
  • Formatting
    1 Posts | Last post August 20, 2018
    • Don't work formatting - Heading1,2...
  • New line distance
    2 Posts | Last post February 09, 2018
    • The new line distance is way to far for what I need but when I press shift+Enter it is at a normal size. Ive spend alot of time trying to find the variable that controls this with no luck
    • I finally fixed it by writing everything in a <div>. I used this.textEditor.InnerHtml to load in my txt file so everything you type is already in a div. TextFile: <div></div>
    1 Posts | Last post October 13, 2017
    1 Posts | Last post October 12, 2017
  • After adding a link, clicking link doesn't follow link
    2 Posts | Last post November 03, 2016
    • Carl,
      Really useful control! Love it.
      Clicking a link doesn't work though.
      Any way to fix this?
    • Figured it out 
       this.editorWebBrowser.Document.Click += Document_Click;
      to BrowserDocumentComplete event
      here is the event
       if (editorWebBrowser.Document != null)
                      HtmlElement elem = editorWebBrowser.Document.GetElementFromPoint(e.ClientMousePosition);
                      switch (elem.TagName)
                          case "A":
                               var href=elem.GetAttribute("href");
      If there is an easier way i'd appreciate it.
      Thanks again for a GREAT control!
1 - 10 of 38 Items