Share a WinForm inside the HTML edit Control zeta HTML editor controls, Chinese-attached source

Source: Internet
Author: User

We know that there are many HTML editing controls on Web development, such as FCKeditor, CKEditor, Kindeditor, and so on, and many are doing well, and although WinForm has WebBrowser controls, the default control is not allowed to edit content. You can display Web pages only. WinForm development inside, some use the RichTextBox control to edit HTML, there are some WebBrowser controls to achieve the content of editing, which I think the best thing to do is the Zeta HTML Edit control (http:// Www.codeproject.com/Articles/43954/ZetaHtmlEditControl), this control is open source on CodeProject, and there is a project maintenance on GitHub (https:// Github.com/uwekeim/zetahtmleditcontrol). This article mainly introduces the use of this control, and some of the resources of the Chinese language, so that we in the actual use of more convenient, and attach the modified control source code, I hope we have some benefits.

1. Control Interface Effect

The control defaults to many toolbars and menus, all in English, and its default effect is as follows.

After the culture of all of its English menus, toolbars, dialogs, prompts, and other resources, and add the Insert Picture, print function in the toolbar, the interface is as follows.

2. Use of controls

Some of the features of a control can be configured to be masked or displayed, by default its initialization code is shown below.

Htmleditusercontrol1.configure (New Htmleditcontrolconfiguration{allowfontchange = True, Allowembeddedimages=true, Allowprint = true});            Htmleditusercontrol1.istoolbarvisible = true;

Allowfontchange if set to True, the font size settings can appear on the toolbar.

Allowembeddedimages, you can convert the picture inside the Clipboard into the string contents of the Base64 string and put it inside the HTML control.

Allowprint is a feature that can be printed.

A control can be assigned to HTML in several ways, as shown below.

Const string s = @ "<p><b>some tests</b></p><p>random content. <font color=green>please edit</font>.</p><p>use Right-click for options.</p> "; Htmleditcontrol1.documenttext = s;

Or

Const string s = @ "<p>click the buttons below to set different texts. German Umlaute:??????? </p> "; Htmleditcontrol1.setdocumenttext (S, @" C: \ ", true);

The control's toolbar can be hidden or displayed as needed

htmleditusercontrol1.istoolbarvisible = toolbarvisiblecheckbox.checked;

3, the existence of control problems

This control is found to have some minor problems during use.

1) You must assign a value to the documenttext of the control to get the contents of the HTML, otherwise the DocumentText obtained by the code is empty after you enter content in the control.

HtmlEditUserControl1.HtmlEditControl.DocumentText = "Wu Huacong test Content";

2) control of the Htmleditcontrol object in the design of the moment can only prompt inside, but the use of no problem, very strange.

4, the control after the Chinese, the entire control of the source code

The control has been completely modified in Chinese culture, which facilitates our daily use.

The controls are as follows: Http://files.cnblogs.com/wuhuacong/ZetaHtmlEditControl.rar

Share a WinForm inside the HTML edit Control zeta HTML editor controls, Chinese-attached source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.