Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void SearchAndSelectWord(string word, int startPos, int endPos, RichTextBoxFinds type)
- {
- this.Suspend();
- if (endOfSearchingFlag)
- {
- index = this.Find(word, startPos, endPos, type);
- ReturnCarriage(ref startPos, ref endPos);
- endOfSearchingFlag = false;
- }
- var preveousIndex = index;
- index = this.Find(word, startPos, endPos, type);
- if (index == -1)
- {
- if (isFirstTimeFlag)
- {
- ReturnCarriage(ref startPos, ref endPos);
- index = this.Find(word, startPos, endPos, type);
- if (index == -1)
- {
- var message = "Cannot find '" + LastWord + "'";
- MessageBox.Show(message, "Terrain Constructor", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- var message = "Finish searching document.";
- MessageBox.Show(message, "Terrain Constructor", MessageBoxButtons.OK, MessageBoxIcon.Information);
- index = preveousIndex;
- endOfSearchingFlag = true;
- }
- }
- else
- {
- this.Select(index, word.Length);
- this.ScrollToCaret();
- this.isFirstTimeFlag = false;
- }
- this.Resume();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement