在C#的文本框中选择多个单词 [英] Select multiple words in a text box in C#

查看:172
本文介绍了在C#的文本框中选择多个单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以选择多个单词(例如:家庭住在住宅中)并跟踪这些选定的单词?

我需要使用鼠标选择单词并将这些单词放在字符串数组中。

如果可能,我该怎么办?

Is it possible to select multiple words(for eg: "The family live in a big house") and track those selected words?
I need to select the words using the mouse and put those selected words in a string array.
If possible, how can i do it?

推荐答案

在文本框中不可能,我担心:它只支持单个连续选择。
Not possible in a Text box, I'm afraid: it only supports a single, contiguous selection.


得到答案, IS posible



Got the answer, and it IS posible

List<string> _Words;
private void richTextBox1_MouseUp(object sender, MouseEventArgs e)
{
    richTextBox1.SelectionBackColor = Color.DeepPink;
    _Words.Add(richTextBox1.SelectedText);
}


你好



有人叫Zhi-Xin Ye发布了一条路几年前在MSDN论坛上做到这一点:



http://social.msdn.microsoft.com/forums/en-US/winforms/thread/1d111531-aeaa-472c-baf4-ffd0850d9ce3 [ ^ ]





Valery。
Hello

Someone called Zhi-Xin Ye posted a way to do this on the MSDN forum a couple of years ago:

http://social.msdn.microsoft.com/forums/en-US/winforms/thread/1d111531-aeaa-472c-baf4-ffd0850d9ce3[^]


Valery.


这篇关于在C#的文本框中选择多个单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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