TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Seyed Ahmad Parkhid
NA
10
25.5k
Rich Text Box Syntax Highlighter
Jan 10 2010 1:45 PM
What is gonna wrong in this code . i want to Highlight "This" word in rich text box .
I have uploaded the code and also the code is listed below :
private int SubStr(int start,string a, string b)
{
int ret = -1;
if (a.Substring(start).Contains(b))
{
ret = a.IndexOf(b[0]);
}
return ret;
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
start = richTextBox1.SelectionStart;
Pos = SubStr(last, richTextBox1.Text, "This");
if (Pos != -1)
{
richTextBox1.Select(Pos, 4);
richTextBox1.SelectionColor = Color.Blue;
richTextBox1.DeselectAll();
last += 4;
}
richTextBox1.SelectionColor = Color.Black;
richTextBox1.SelectionStart = start;
}
Attachment:
SyntaxHiglighter.zip
Reply
Answers (
1
)
problem in custom shaped windows forms and transparencyKey
Rich Text Box Syntax Highlighter