在列表框中突出显示子字符串 [英] Highlighting Substring in listbox

查看:86
本文介绍了在列表框中突出显示子字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我只需要突出显示整个字符串的一部分:如果用户在文本框中输入Prop,则突出显示的输出将是
在字符串"Dependency property"中,我们只需要突出显示"Prop".请让我知道解决方案.

I need to Highlight only the Portion of that whole string for example:if user enters Prop in textbox the highlighted output will be
in String "Dependency property" word we need to highlight only "Prop".Please let me know the Solution.

推荐答案

您不能将不同的文本样式应用于TextBox,则应考虑使用RichTextBox.
You can''t apply different text styles to a TextBox, you should consider using a RichTextBox instead.


您不会回答我的问题:TextBoxListBox.

我认为这与问题的标题和内容之间没有矛盾.您可能只是一件事.虽然我认为Olivier在TextBox/RichTextBox上的答案已经足够好了,但是对于ListBox来说,您所需的文本呈现并不是那么容易实现.您可以创建自己的控件(可能从ListBox派生)并对其进行自定义绘制.

—SA
You don''t answer my question: TextBox or ListBox.

I think this is no a contradiction between title and body of the question. You probably meant just one thing. While I think the answer by Olivier on TextBox/RichTextBox is good enough, the text rendering you need is not so easy to achieve for ListBox. You can create your own control (probably derived from ListBox) and custom-paint it.

—SA


这篇关于在列表框中突出显示子字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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