c# - Highlight all words containing a letter in a richtextbox -


How do I highlight all the words in a letter in a rich text box? If I want to expose the words that contain the letters "a", such as a hat or candle word, both words are highlighted, I am using C # on Winform.

  Private Zero Button 208_Click (Object Sender, EventArgs E) {HighlightFrage (Rich Textbox 1, "A", Color. Yellow); }  

It exposes all the words with a word "a", but I'm not sure how to highlight the length of the spaces. Thank you.

You can use the method to find incidents of sub-location. Then, use the property to change the colors back to Highlight colors for each event.

  int len ​​= richTextBox.TextLength; Int index = 0; String textconfind = "A"; // This will highlight the text you are viewing (index & lt; len) {richTextBox.Find (textToFind, index, len, RichTextBoxFinds.None); RichTextBox.SelectionBackColor = Color.Yellow; Index = rich textbox. Lesson Index (texttofind, index) + textaophind Langeline; }  

If you want to highlight all words containing a certain letter, whenever you find an incident in the letter, you will have to search for word boundaries (left and right letter Indicator) and once you recognize them, select the entire word using the method of RichTextBox control.

  richTextBox.Select (vocabulary start, wordboundary end-wordbreaking start);  

Comments

Popular posts from this blog

c# - MySQL Parameterized Select Query joining tables issue -

import - Python ImportError: No module named wmi -

android - how to add several images in a listview after getting their names from the sqlite database -