Hey does anyone know of a effiecient method of highlighting a richtext box for keywords. When I open the file and format the colors this is the code that i use for the keywords
This takes a long time to format, does anyone have any sugestions of a better way?Code:foreach(string word in this.ReservedWords) { Regex rgx=new Regex(word , RegexOptions.IgnoreCase); MatchCollection mCol=rgx.Matches(this.rtfSource.Text); foreach(Match m in mCol) { this.rtfSource.HideSelection=true; this.rtfSource.Select(m.Index , m.Length); this.rtfSource.SelectionColor=Color.Blue; this.rtfSource.SelectionStart=m.Index + m.Length; this.rtfSource.SelectionLength=0; } }
Thanks


Reply With Quote

