Click here to Skip to main content
6,596,602 members and growing! (19,981 online)
Email Password   helpLost your password?
Languages » C# » Samples     Intermediate

WYSIWYG HTML Editor

By Shlomo Schwarcz

Building a simple WYSIWYG (What You See Is What You Get) HTML Editor in C#.
C#, Windows, .NET 1.1VS.NET2003, Dev
Posted:6 Jan 2006
Views:85,581
Bookmarked:56 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
14 votes for this article.
Popularity: 4.63 Rating: 4.04 out of 5
2 votes, 15.4%
1

2
2 votes, 15.4%
3
2 votes, 15.4%
4
7 votes, 53.8%
5

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

About the Author

Shlomo Schwarcz


Member
Shlomo had worked for several years as a software engineer and project manager, developing software for the enterprise market, in Microsoft.NET and Java J2EE environment. Before establishing Shefer’s SAP department, Shlomo worked at SAP Labs and took part of the NetWeaver and Enterprise Portal development team.

Shlomo has many years of experience with SAP customers and has also teaches official SAP courses around the world.


Occupation: Web Developer
Location: Israel Israel

Other popular C# articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 33 (Total in Forum: 33) (Refresh)FirstPrevNext
GeneralCongratulations on the good work PinmemberRene.DH11:43 18 Apr '09  
Question[BR /] instead of [P/]? Pinmemberaj3215:18 12 Jun '08  
GeneralCan I insert tables? PinmemberDrucik_14:02 20 Apr '08  
AnswerRe: Can I insert tables? PinmemberBITS_UK0:13 27 May '08  
Generalcopied imaged from ms word doesn't show PinmembernetJP12L12:21 23 Jan '08  
GeneralImages dont apprear when copied from Ms word PinmembernetJP12L12:15 23 Jan '08  
GeneralThanks, just what I needed Pinmembervictorbos4:21 1 Nov '07  
QuestionProblem with Deploy Different Version shdocvw.dll Pinmembersebandres6:31 20 Feb '07  
GeneralHow can i insert a text in a given position? Pinmemberrespiratory10112:56 26 Sep '06  
Generalhow to change the language of the text Pinmemberalihammad5:22 28 Aug '06  
QuestionWYSIWYG WORD Pinmember123456uio4:16 9 Aug '06  
Generalwhere are html, title, head, meta tags ? PinmemberRobcast21:38 29 Jun '06  
GeneralRe: where are html, title, head, meta tags ? PinmemberRobcast25:00 29 Jun '06  
QuestionAdding Events PinmemberAbhiTheGenius22:50 13 May '06  
AnswerRe: Adding Events PinmemberShlomo Schwarcz23:33 13 May '06  
GeneralReference PinmemberDeathJester_10:50 26 Mar '06  
QuestionInvalidCastException Unhandled Pinmemberpjrinaldi19:45 18 Feb '06  
AnswerI think I know the problem PinmemberShlomo Schwarcz21:46 18 Feb '06  
QuestionRe: I think I know the problem Pinmemberpjrinaldi5:05 19 Feb '06  
AnswerRe: I think I know the problem PinmemberShlomo Schwarcz5:08 19 Feb '06  
QuestionRe: I think I know the problem Pinmemberpjrinaldi6:03 19 Feb '06  
AnswerRe: I think I know the problem Pinmemberpjrinaldi18:23 20 Feb '06  
GeneralRe: I think I know the problem Pinmemberbrb554811:43 5 Feb '09  
GeneralBuild error Pinmemberpietro775:35 11 Jan '06  
GeneralRe: Build error PinmemberShlomo Schwarcz20:23 11 Jan '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 6 Jan 2006
Editor: Smitha Vijayan
Copyright 2006 by Shlomo Schwarcz
Everything else Copyright © CodeProject, 1999-2009
Web11 | Advertise on the Code Project