Click here to Skip to main content
13,449,194 members (42,818 online)
Click here to Skip to main content
Add your own
alternative version


177 bookmarked
Posted 17 Nov 2009

Zeta HTML Edit Control

, 9 Jul 2013
Rate this:
Please Sign up or sign in to vote.
A small wrapper class around the Windows Forms 2.0 WebBrowser control


This article presents you a small wrapper class around the Windows Forms 2.0 WebBrowser control.


The wrapper is no rocket science but provides some features I struggled with in the past. We use the control in several of our own (internal and external) applications, e.g. our Test Management tool

Some of the features include:

  • Enable the setting of text even when the control is not yet fully initialized
  • Allow pasting of images from the clipboard
  • Allows for resizing the images within the editor with the mouse 
  • Provide an alternative context menu for applying formatting options
  • Optionally directly edit the underlying HTML source code
  • Translated resources in English and German
  • Interface IExternalInformationProvider for externally persisting and restoring settings
  • Provide standard CSS in the control; usually you do not need to define your own CSS

Using the Code

To include the code in your own project, simply include the "ZetaHtmlEditControl.dll" assembly into your project.

Add the assembly to your Visual Studio .NET 2008 Windows Forms Designer Toolbox if you want to be able to drag the ExtendedWebBrowser control to your forms. Alternatively create and initialize an instance of the ExtendedWebBrowser control by code.

Setting HTML

To put HTML from your code into the control, assign the HTML code to the ExtendedWebBrowser.DocumentText property. You do not have to pass a complete HTML document with HEAD and BODY tags but only the actual content that you would write inside the BODY tag.

Getting the HTML 

To read out the HTML from the control, call the ExtendedWebBrowser.GetDocumentText(string folderPath) method. The method takes one parameter "folderPath" that tells the control where to store newly passed images from the clipboard. 


This article quickly introduced a wrapper around the Windows Forms 2.0 WebBrowser control that adds some extra functions to make it more usable in a real-world-application. Feel free to copy, modify or extend the control to match your own requirements.

To ask questions, suggest features or provide other comments, please use the comments section at the bottom of this article.


  • 2013-07-09 - You now also find the project on GitHub
  • 2013-05-20 - Images inside the edit control can now be resized proportionally to make them smaller. When persisting the images, they are actually resized on disk, too.
  • 2011-06-02 - Added support for inserting and editing tables. Added new user control that has a toolbar (see screenshot) that you can switch on and off from code.
  • 2011-03-16 - Updated for and tested with the latest Internet Explorer 9 (RTM). If you do experience AccessViolation exceptions when working with this control, please read this MSDN blog posting that suggests to add a custom build step
    editbin.exe /NXCOMPAT:NO "$(TargetPath)"
  • 2011-02-26 - Update to (hopefully) make the control work with Internet Explorer 9 RC work again. See this Stack Overflow posting for details. I've included a mini web server with the control to serve the texts from this server, instead of setting it directly. It should be 100% transparent to the user of the code.
  • 2009-11-18 - First public release to


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Uwe Keim
Chief Technology Officer Zeta Producer Desktop CMS
Germany Germany
Uwe does programming since 1989 with experiences in Assembler, C++, MFC and lots of web- and database stuff and now uses ASP.NET and C# extensively, too. He has also teached programming to students at the local university.

In his free time, he does climbing, running and mountain biking. Recently he became a father of a cute boy.

Some cool, free software from us:

German Developer Community  
Free Test Management Software - Intuitive, competitive, Test Plans. Download now!  
Homepage erstellen - Intuitive, very easy to use. Download now!  
Send large Files online for free by Email

You may also be interested in...


Comments and Discussions

GeneralRe: My vote of 5 Pin
Uwe Keim28-Feb-11 9:03
sitebuilderUwe Keim28-Feb-11 9:03 
GeneralIE9 breaks control Pin
wknopf16-Feb-11 11:23
memberwknopf16-Feb-11 11:23 
GeneralRe: IE9 breaks control Pin
Uwe Keim16-Feb-11 19:20
sitebuilderUwe Keim16-Feb-11 19:20 
QuestionRe: IE9 breaks control Pin
wknopf16-Feb-11 19:38
memberwknopf16-Feb-11 19:38 
AnswerRe: IE9 breaks control Pin
Uwe Keim16-Feb-11 19:42
sitebuilderUwe Keim16-Feb-11 19:42 
GeneralVery good! Pin
rodrigopa11-Aug-10 2:16
memberrodrigopa11-Aug-10 2:16 
GeneralRe: Very good! Pin
Uwe Keim11-Aug-10 2:20
mvpUwe Keim11-Aug-10 2:20 
GeneralFirst of all 5 from me Pin
mheidari24-Nov-09 1:21
membermheidari24-Nov-09 1:21 
hi dear

first of all you got five for me, now i have a question about your editor,

i already use some of html editors in win forms but some times i got some unhandled exception that throwed from COM. for example when im using editors that wraps WebBrowser in my own win forms, when im closing my form then throws an exception :

<b>RaceOnRCWCleanup was detected</b>
Message: An attempt has been made to free an RCW that is in use.   The RCW is in use on the active thread or another thread.   Attempting to free an in-use RCW can cause corruption or data loss.

unfortunately i have no idea for this Confused | :confused: and why this exception raises   D'Oh! | :doh:

now if i use your editor ! what happens to me   Blush | :O

also im sorry for my highland English speaking   Big Grin | :-D

If you think you has fallen out of an elephant's nose ; I make you a donkey

GeneralRe: First of all 5 from me Pin
Uwe Keim24-Nov-09 2:47
sitebuilderUwe Keim24-Nov-09 2:47 
GeneralRe: First of all 5 from me Pin
mheidari24-Nov-09 22:14
membermheidari24-Nov-09 22:14 
General5 Sterne / 5 Stars Pin
Midnight Run19-Nov-09 5:43
memberMidnight Run19-Nov-09 5:43 
GeneralRe: 5 Sterne / 5 Stars Pin
Uwe Keim19-Nov-09 5:49
sitebuilderUwe Keim19-Nov-09 5:49 
GeneralRe: 5 Sterne / 5 Stars Pin
Midnight Run19-Nov-09 5:55
memberMidnight Run19-Nov-09 5:55 
Question"Control" Project does not compile - Missing File? Pin
andre1234518-Nov-09 2:12
memberandre1234518-Nov-09 2:12 
AnswerRe: "Control" Project does not compile - Missing File? Pin
Uwe Keim18-Nov-09 3:11
sitebuilderUwe Keim18-Nov-09 3:11 
GeneralRe: "Control" Project does not compile - Missing File? Pin
andre1234519-Nov-09 0:53
memberandre1234519-Nov-09 0:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03-2016 | 2.8.180318.3 | Last Updated 9 Jul 2013
Article Copyright 2009 by Uwe Keim
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid