回复 5楼DCAgile的帖子
问题二,看看以下代码能否实现你想要的效果:
- private void SetSpecialStyle()
- {
- int start = this.textControl1.Selection.Start;
- List<string> list = new List<string>();
- list.Add("上");
- list.Add("下");
- list.Add("重病");
- list.Add("可见");
- int index = -1;
- for (int i = 0; i < list.Count; i++)
- {
- do
- {
- index = this.textControl1.Find(list[i], index + 1, TXTextControl.FindOptions.NoMessageBox);
- this.textControl1.Selection.ForeColor = Color.Red;
- } while (index != -1);
- }
- this.textControl1.Select(start,0);
- }
复制代码 |