Dear friends,
I am developing a spell checker, I want to get the data in richtextbox spell checked and that I am able to do it. But I want to highlight the word which is wrongly spelled and let it remain highlighted till replaced. I have adopted the method of richtextbox select and have provided the range also, but not able to correctly select the word at the runtime. Is there any method or logic to do so.
Thanking you in anticipation.
How to select a word at runtime in richtextbox
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Mahesh ChandRank #1 · 392.9K pointsPosted Jun 27, 2007, 6:10 AM EDT
http://www.c-sharpcorner.com/UploadFile/duncanharris/SyntaxHighlightInRichTextBoxP112012005050840AM/SyntaxHighlightInRichTextBoxP1.aspx
http://www.c-sharpcorner.com/UploadFile/duncanharris/SyntaxHighlightInRichTextBoxP112012005050840AM/SyntaxHighlightInRichTextBoxP1.aspx
jebasingh27 pointsPosted Jun 28, 2007, 1:31 AM EDT
specify the start position of the word that has to be corrected..
rText1.SelectionStart =0;
specify the length of the word.
rText1.SelectionLength = 6;
give the color code for the selected word
rText1.SelectionColor = Color.Red;
if you set the hideselection property to false the word that has to be corrected will be selected
rText1.HideSelection =false;
set the font ,size and style to the word
rText1.SelectionFont = new Font("Courier New", 12,FontStyle.Regular);