| 3 | 1/1 | 返回列表 |
| 查看: 903 | 回復: 2 | |||
[交流]
【求助】C#中用到控件richtext,如何使richtext中的內(nèi)容被選中或者變色啊
|
| 做一個實現(xiàn)文本查找的查找器,用C#實現(xiàn),其中用到控件richtext,對richtext.text的內(nèi)容進行搜索,當所要搜索的內(nèi)容存在richtext中時,在richtext中重點顯示,要不選中存在的搜索內(nèi)容,要不使之變色,但不知道怎么實現(xiàn),麻煩高手指點…… |
» 搶金幣啦!回帖就可以得到:
+1/192
+1/189
+1/188
+2/136
+1/90
+1/88
+1/74
+1/38
+1/38
+1/34
+1/32
+1/17
+1/8
+3/7
+1/7
+1/6
+1/6
+1/5
+1/5
+1/4
|
private void button1_Click(object sender, EventArgs e) { this.richTextBox1.Text = "做一個實現(xiàn)文本查找的查找器,用C#實現(xiàn),其中用到控件richtext,對richtext.text的內(nèi)容進行搜索,當所要搜索的內(nèi)容存在richtext中時,在richtext中重點顯示,要不選中存在的搜索內(nèi)容,要不使之變色,但不知道怎么實現(xiàn),麻煩高手指點……"; string findText = "richtext"; for (int i = 0; i < richTextBox1.Text.Length; i++) { int startLoc = this.richTextBox1.Find(findText, i, RichTextBoxFinds.None ); if (startLoc > -1) { this.richTextBox1.Select(startLoc, findText.Length); this.richTextBox1.SelectionBackColor = Color.Red; i = startLoc; } } } |
| 3 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 327求調(diào)劑 +3 | 小卡不卡. 2026-03-29 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 材料與化工328分調(diào)劑 +7 | 。,。,。,。i 2026-03-23 | 7/350 |
|
|
[考研] 材料科學與工程求調(diào)劑 +6 | 深V宿舍吧 2026-03-29 | 6/300 |
|
|
[考研] 求調(diào)劑 +9 | 張zz111 2026-03-27 | 10/500 |
|
|
[考研] 329求調(diào)劑 +10 | 鈕恩雪 2026-03-25 | 10/500 |
|
|
[考研] 求調(diào)劑 +7 | 爭取九點睡 2026-03-28 | 8/400 |
|
|
[考研] 生物學學碩,一志愿湖南大學,初試成績338 +6 | YYYYYNNNNN 2026-03-26 | 7/350 |
|
|
[考研] 復試調(diào)劑 +3 | raojunqi0129 2026-03-28 | 3/150 |
|
|
[考研] 藥學105500求調(diào)劑 +3 | Ssun。。 2026-03-28 | 3/150 |
|
|
[考研] 295求調(diào)劑 +5 | 1428151015 2026-03-27 | 6/300 |
|
|
[考研] 352分 化工與材料 +5 | 海納百川Ly 2026-03-27 | 5/250 |
|
|
[論文投稿] Journal of Mechanical Science and Technology +3 | Russ_ss 2026-03-25 | 5/250 |
|
|
[考研] 0703化學一志愿南京師范大學303求調(diào)劑 +3 | zzffylgg 2026-03-24 | 3/150 |
|
|
[考研]
材料學碩,求調(diào)劑
6+5
|
糖葫蘆888ll 2026-03-22 | 10/500 |
|
|
[考研] 343求調(diào)劑 +4 | 贈我一本書 2026-03-23 | 4/200 |
|
|
[考研] 調(diào)劑 +4 | 柚柚yoyo 2026-03-26 | 4/200 |
|
|
[考研] 081700 調(diào)劑 267分 +11 | 迷人的哈哈 2026-03-23 | 11/550 |
|
|
[考研] 化工專碩求調(diào)劑 +3 | question挽風 2026-03-24 | 3/150 |
|
|
[考研] 277分求調(diào)劑,跨調(diào)材料 +3 | 考研調(diào)劑lxh 2026-03-24 | 3/150 |
|
|
[考研] 341求調(diào)劑(一志愿湖南大學070300) +5 | 番茄頭--- 2026-03-22 | 6/300 |
|