CBuilder / Delphi的HTML编辑器 [英] HTML Editor for CBuilder/Delphi

查看:202
本文介绍了CBuilder / Delphi的HTML编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到基本的WYSIWYG HTML编辑器组件为C ++ Builder 5让用户创建一些简单的文本,我将粘贴到现有的HTML页面模板。
只需简单的支持创建链接,添加图片,使用标题/粗体/斜体。

解决方案

一个表单上的TWebBrowser,并启用其设计模式,如下所示:

  // Delphi代码.. 
(WebBrowser1 。文档为IHTMLDocument2).designMode:='on';

执行上述行后,页面将可编辑。您可以输入额外的文字,删除等。如果要选择粗体或插入图像,您将不得不添加一些按钮来编程。很酷的是,您可以从Delphi(或您的案例中的C ++构建器)执行此操作,也可以在页面上添加JavaScript以进行编辑。



可以从

 (WebBrowser文件为IHTMLDocument2).body.innerHTML; 

请记住(WebBrowser.Document as IHTMLDocument2)可能为零。






无论如何,我可以想象,有些组件可以为您做所有的工作,这可能是重新发明轮子的更好的路线。 / p>

I need to find basic WYSIWYG HTML editor component for C++Builder 5 to let users to create some simple text that I will paste into existing HTML page template. Just a simple support to create links, add images, use headers/bold/italic.

解决方案

You can drop a TWebBrowser on a form and enable designmode on it, like this:

// Delphi code..
(WebBrowser1.Document as IHTMLDocument2).designMode := 'on';

After executing the above line, the page will be editable. You can type extra text, delete, etc. If you want to make selections bold or insert images, you're going to have to add some buttons to program that. The cool thing is that you can do that either from Delphi (or C++ builder in your case) or you can add javascript on the page to edit itself.

The contents of the page can be retrieved from

(WebBrowser.Document as IHTMLDocument2).body.innerHTML;

Remember that (WebBrowser.Document as IHTMLDocument2) could be nil.


Anyway, I can imagine that there are components around that do all the work for you, which is probably a better route to take than reinventing the wheel.

这篇关于CBuilder / Delphi的HTML编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆