c# RichTextBox用法——设置指定字符串的颜色
来源:互联网 发布:金鼎娱乐源码下载 编辑:程序博客网 时间:2024/06/08 19:51
本文转载连接: http://blog.csdn.net/crazytaliban/article/details/52002657
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace RichTextBoxUse
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ArrayList list = getIndexArray(richTextBox1.Text, "str1");
for (int i = 0; i < list.Count; i++)
{
int index = (int)list[i];
richTextBox1.Select(index, "str1".Length);
richTextBox1.SelectionColor = Color.Red;
}
}
private ArrayList getIndexArray(String inputStr, String findStr)
{
ArrayList list = new ArrayList();
int start = 0;
while (start < inputStr.Length)
{
int index = inputStr.IndexOf(findStr, start);
if (index >= 0)
{
list.Add(index);
start = index + findStr.Length;
}
else
{
break;
}
}
return list;
}
}
}
- c# RichTextBox用法——设置指定字符串的颜色
- RichTextBox用法——设置指定字符串的颜色
- RichEditControl用法——设置指定字符串的字体颜色
- C# richtextbox查找和替换指定字符串
- c#中richTextBox的用法
- C# richTextbox的 字体格式颜色等等
- C# richTextbox的 字体格式颜色
- C# richTextbox的 字体格式颜色等等
- C# RichTextbox的字体格式和颜色
- c#中richtextbox显示不同的颜色
- 修改字符串中一段的颜色——字符串改变指定位置的颜色
- iOS设置字符串指定位置的颜色和字体
- 设置指定文字的颜色
- richTextBox换行的用法
- C# RichTextBox的使用方法
- C# RichTextBox的使用方法
- 设置RichTextBox中的指定行为选中状态!!
- 设置标签中字符串的子串(指定位置)的颜色
- caffe中 solver.prototxt文件
- POJ 2823 Sliding Window (单调队列)
- A. K-Periodic Array----思维
- Python高级
- 剑指OFFER--二进制中1的个数
- c# RichTextBox用法——设置指定字符串的颜色
- 函数指针与回调函数的用法
- c++virtual的动态调用验证
- 线程状态及属性
- struts2--struts2标签库(部分)
- 【并查集入门专题1】poj1182【带权值的并查集】【思维思维~~】
- Ubuntu16.04 安装MySQL全过程~
- ReLu(Rectified Linear Units)激活函数
- 记录下 Java 中对于 String 的 replace() 方法使用不当