创建自定义的RichTextBox控制 [英] Creating custom RichTextBox control

查看:110
本文介绍了创建自定义的RichTextBox控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我需要创建自定义的RichTextBox 在C#中。一种这样的:

I believe am in need of creating custom RichTextBox in C#. One kind of like that:

我承认它可能甚至没有为的RichTextBox ,但经过一番研究,我决定这会是最简单的办法。功能我需要的是在每行的图标,复选框和文本格式。我的程序将处理每行文本和标记是正确的,不正确的线路,并重拳出击开展进一步的工作没有必要线,同时显示出的当前处理线,并允许用户自由(这里编辑一些行:前行的约3 000 的不会是可编辑的,但是这些线下会)。

I admit it might not even have to be RichTextBox, but after some research I decided it's gonna be the easiest way. Functionality I need are icons at each row, checkboxes and text formatting. My program will process each line of the text and mark lines that are correct, incorrect, and strike out lines not necessary in further work, while showing line that's currently processed and allowing user to edit some lines freely (here: lines before Around 3 000 won't be editable, but those under the line will).

这是什么问题呢?我不知道如何完成它。我已经看到了教程如何让单行的textBox 带图标或复选框附近的,但我不知道如何使双方,并为多行TextBox(这样我就可以自由地滚动,一切都会流利工作)。我读过关于SO还有一些问题,但也帮助了我。

What's the problem then? I have no idea how to get it done. I've seen tutorial on how to make single-line textBox with icon or checkbox nearby, but I have no idea how to make both, and for multiline textBox (so I could freely scroll and everything would work fluently). I've read some questions on SO as well, but neither helped me.

我只是不知道如何开始,我意识到它不会是5分工作,但我愿意这样做。到现在为止我已经只能够创建自定义的控制,从的RichTextBox 导出,但我不知道方法以及如何覆盖它。任何帮助表示赞赏。

I just don't know how to get started, I realize it won't be 5 min work, but I'm willing to do it. Until now I've been only able to create custom control deriving from RichTextBox, but I have no idea which methods and how to override. Any help appreciated.

推荐答案

尝试使用的 web浏览器 控制代替的 的RichTextBox

Try to use WebBrowser control instead RichTextBox.

您可以添加的CheckBox 和正确的 HTML 代码设置为可编辑的内容。

You can add CheckBoxes and editable content by setting a correct HTML code to it.

设置每个文本框 CheckBoxe 取值IDS和使用<一个HREF =http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.getelementsbytagname相对=nofollow> 的getElementsByTagName 的getElementById 访问内部元素获取或设置其属性或值。

Set each TextBox or CheckBoxes ids and use GetElementsByTagName or GetElementById to access inner elements to get or set its attributes or values.

这篇关于创建自定义的RichTextBox控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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