如何在C#中使文本可修改(doubleClick,更改颜色,..)中的单词 [英] How to make a word in a text modifiable(doubleClick, change color,..) in C#

查看:130
本文介绍了如何在C#中使文本可修改(doubleClick,更改颜色,..)中的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我遇到问题,我将文本存储在xml文件格式中,如下所示:

I have a problem, i have text stored in xml file formatting like this:

<sentence>
    <token tag='man'>
        John
    </token>
    <token>
        is
    </token>
    <token>
        a doctor
    </token>
</sentence>
<sentence>
    <token tag='man'>
        He
    </token>
    <token>
        has
    </token>
    <token>
        a wife
    </token>
</sentence>
....



我想为用户显示此文本(在文本框,面板等上),并且标记为tag =''man''(在本例中为John,He)的标记与其余颜色不同,再加上,可以单击它们(以显示其他信息等).看来在ToolBox中没有这样的工具可以做到这一点.所以我不知道如何解决,有人有什么建议吗?
感谢您阅读本文!



I want to show this text for User(on a TextBox, a Panel,...) ,and tokens which have tag=''man''(in this case:John,He) have different color from the rest, plus, they can be Clicked (to show extra information,etc). It appears that in ToolBox there is not such a tool could do this. So I don''t know how to solve it, does anybody have any suggestions?
Thanks for reading this!

推荐答案

您将需要开发自己的控件,例如,在System.Windows.Forms.RichTextBox的基础上,请参见:
http://msdn.microsoft.com/en-us/library/system. windows.forms.richtextbox.aspx [ ^ ].

—SA
You will need to develop you own control, for example, on the base of System.Windows.Forms.RichTextBox, please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.aspx[^].

—SA


这篇关于如何在C#中使文本可修改(doubleClick,更改颜色,..)中的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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