Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void SearchWindow_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Escape)
- {
- this.Close();
- }
- else if (e.KeyCode == Keys.F3 && e.Shift)
- {
- if (outputRichTextBox.LastWord == "")
- outputRichTextBox.ShowSearchWindow();
- else
- {
- var word = outputRichTextBox.LastWord;
- var mouthIndexPos = outputRichTextBox.SelectionStart;
- outputRichTextBox.Index = mouthIndexPos;
- var index = outputRichTextBox.Index;
- this.outputRichTextBox.SearchAndSelectWord(word, 0, index, RichTextBoxFinds.Reverse);
- }
- }
- else if (e.KeyCode == Keys.F3)
- {
- if (this.outputRichTextBox.LastWord == "")
- this.outputRichTextBox.ShowSearchWindow();
- else
- {
- var mouthIndexPos = outputRichTextBox.SelectionStart;
- var word = this.outputRichTextBox.LastWord;
- this.outputRichTextBox.Index = outputRichTextBox.SelectionStart;
- var endPos = this.outputRichTextBox.TextLength;
- var startPos = outputRichTextBox.Index + word.Length;
- if (startPos > endPos)
- startPos = endPos - 1;
- this.outputRichTextBox.SearchAndSelectWord(word, startPos, endPos, RichTextBoxFinds.None);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement