实现如下效果:

一开始想法是查找关键词,根据关键词是前有回车符来过滤,后来在CSDN上请教高手,

这样实现的:

string key = Regex.Escape("水动力条件");
Regex reg
= new Regex(@"(?m)^" + key);
MatchCollection mc
= reg.Matches(rtbZRGK.Text);
foreach (Match m in mc)
{
rtbZRGK.SelectionStart
= m.Index;
rtbZRGK.SelectionLength
= m.Value.Length;
rtbZRGK.SelectionFont
= new Font(rtbZRGK.SelectionFont, FontStyle.Bold);
}

 

学习了

posted on 2010-05-03 10:24  秋波渡  阅读(384)  评论(0编辑  收藏  举报