Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

WYSIWYG HTML Editor

0.00/5 (No votes)
6 Jan 2006 1  
Building a simple WYSIWYG (What You See Is What You Get) HTML Editor in C#.

Sample Image

Introduction

I have found different code samples showing how to create a visual HTML editor in ASP using a text area. However, I needed a good editor for my WinForms application, but I couldn�t find a good example. Eventually, I wrote one from scratch after I converted some MFC code I found on the net. Based on the IE Browser control, you can create a powerful editor that allows you to manipulate HTML tags visually and add any tags you want.

Using the code

The code is a simple form, and very easy to understand. In order to make it work, you first need to include two COM libraries:

  1. The Microsoft Web Control found in: c:\windows\system32\shdocvw.dll (add as a COM control).
  2. MSHTML: c:\windows\system32\MSHTML.tlb (add as a COM reference).

The reason for the tlb is that the mshtml.dll is used by the Windows system, and therefore is not accessible.

You don't need to worry about deployment: all Windows users will have these DLLs in their system directory.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here