winforms html editor
You can use the WebBrowser control in design mode with a second WebBrowser
control set in view mode.
In order to put the WebBrowser
control in design mode, you can use the following code.
This code is a super stripped down version of a WYSIWYG editor for one of our software products.
Simply create a new Form, drop a WebBrowser
control on it, and put this in the Form.Load:
Me.WebBrowser1.Navigate("")
Application.DoEvents()
Me.WebBrowser1.Document.OpenNew(False).Write("<html><body><div id=""editable"">Edit this text</div></body></html>")
'turns off document body editing
For Each el As HtmlElement In Me.WebBrowser1.Document.All
el.SetAttribute("unselectable", "on")
el.SetAttribute("contenteditable", "false")
Next
'turns on editable div editing
With Me.WebBrowser1.Document.Body.All("editable")
.SetAttribute("width", Me.Width & "px")
.SetAttribute("height", "100%")
.SetAttribute("contenteditable", "true")
End With
'turns on edit mode
Me.WebBrowser1.ActiveXInstance.Document.DesignMode = "On"
'stops right click->Browse View
Me.WebBrowser1.IsWebBrowserContextMenuEnabled = False
C# WYSIWYG HTML Editor in a Windows Forms Application
You can try spicelogic and netrix
or put one of the above editors in a WebBrowser
control.
Hope will it help.
.Net HTML Editor Control
You can also try one of these strategies:
Use the RichTextBox control, which exposes a FlowDocument. Write a program that converts the FlowDocument to HTML. Since FlowDocs are much more constrained that HTML, this conversion might be pretty straightforward (sections -> div, paragraph -> p, styles -> css or style attributes, etc).
Use MSHTML and put it into edit mode. http://msdn.microsoft.com/en-us/library/aa753622(v=vs.85).aspx
Related Topics
Iterate Multi-Dimensional Array with Nested Foreach Statement
How to Reference Embedded Images from CSS
A Method for Making Http Requests on Unity iOS
Python: Inflate and Deflate Implementations
What Setup Code Should Go in Form Constructors Versus Form Load Event
Ef Code-First One-To-One Relationship: Multiplicity Is Not Valid in Role * in Relationship
How to Put a Task to Sleep (Or Delay) in C# 4.0
Raise Event in High Resolution Interval/Timer
What Are the Benefits to Marking a Field as 'Readonly' in C#
How Does Wcf Deserialization Instantiate Objects Without Calling a Constructor
How to Verify Text Is Bold Using Selenium on an Angular Website with C#
How to Add a Custom View to a Xib File Defined View in Monotouch
Why New Fb API 2.4 Returns Null Email on MVC 5 with Identity and Oauth 2