开发者

How to highlight portion of a Rich TextBox WPF control if there are more than 2 spaces?

I have a richtextbox control in my WPF 4.0 application. Now suppose I have a text like

"hello how [space][space] r u? [space][space] I am fine"

As can be noticed that there are two gaps between how and r as well as between ? and I.

When this will happen then the portion will be highlighted with green e.g. how ..r and from ? to I will be highlighted with green color.

i.e. if the space between two words are more than 2 then that will be highlighted with green开发者_Python百科.

Is it possible to do in WPF RichTextbox control? If so, please help me in writing so. As of now what I have done is that I have only able to find out the distance of spaces between two words.

Note:~ [Space] means the white spaces. Since the gap was not prominent(as it was not coming in the editor), that's the reason I made it like so.

Thanks

WPF4.0/ C#4.0


http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7c9a622a-4e3b-451e-bc4c-ab9d011447e0

Here is a progressive scenario featuring RichTextBox highlighting multiple ranges, it may lead you on the right path.

He ends up getting it to work, but you will have to modify it to recognize white space perhaps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜