var wordsToHighlight = new List<string>() { "sign ID1:", "user:", "autohotkey", "bloody" };
if (!string.IsNullOrWhiteSpace(richTextBox1.Text))
foreach (var word in wordsToHighlight)
int index = 0;
while (index != -1)
richTextBox1.SelectionColor = Color.Red;
index = richTextBox1.Find(word, index + word.Length - 1, richTextBox1.TextLength, RichTextBoxFinds.None);
현재이 코드를 사용하여 richtextbox에서 단어를 검색하고 강조 표시합니다. 프로그램과 동일한 폴더에서 단어의 .txt 파일을 사용하여 { "The", "is", "what", "story" }
을 바꿀 수 있으며 .txt 파일의 단어를 사용하여 검색 할 수 있습니까?로드 목록 <string> .txt
예 :
Line 1 = The
Line 2 = is
Line 3 = what
Line 4 = story
을 할 수 있도록 배열,
IEnumerable
있습니다. 이 코드는 무엇을하기로되어 있습니까? – meJustAndrew귀하의 질문은 어디에 있습니까? – codelab
richtextbox에 로그 파일을 열려고하고 { "The", "is", "what", "story"} 목록에서 + 강조 키워드를 검색하고 있습니다. 그렇지만 .txt 파일에서 해당 키워드를 변경하고 해당 키워드로 로그 파일을 검색하려고합니다. 그래서 .txt 파일이 { "The", "is", "what", "story"}를 대체하기를 원합니다. 그렇게함으로써 키워드를 변경해야 할 때마다 프로그램을 재구성하지 않아도됩니다. 나는 척처럼 붙어있다. – Cdapimp