private void txtFind_TextChanged(object sender, EventArgs e) { this.txtFind.BackColor = SystemColors.Window; if (this.txtFind.Text == string.Empty) { return; } if (_scintilla == null) { return; } int pos = Math.Min(_scintilla.CurrentPosition, _scintilla.AnchorPosition); ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.Find(pos, _scintilla.TextLength, this.txtFind.Text, _findReplace.Window.GetSearchFlags()); if (r.cpMin == r.cpMax) { r = _findReplace.Find(0, pos, this.txtFind.Text, _findReplace.Window.GetSearchFlags()); } if (r.cpMin != r.cpMax) { _scintilla.SetSel(r.cpMin, r.cpMax); } else { this.txtFind.BackColor = Color.Yellow; } MoveFormAwayFromSelection(); }
private void FindResultsScintilla_KeyUp(object sender, KeyEventArgs e) { int pos = FindResultsScintilla.CurrentPosition; int selectedLine = FindResultsScintilla.LineFromPosition(pos); if (_findAllResults?.Count > selectedLine) { ScintillaNET_FindReplaceDialog.CharacterRange CharRange = _findAllResults[selectedLine]; Scintilla.SetSelection(CharRange.cpMin, CharRange.cpMax); Scintilla.ScrollCaret(); } }
private void FindResultsScintilla_MouseClick(object sender, MouseEventArgs e) { int pos = FindResultsScintilla.CharPositionFromPointClose((e.Location).X, (e.Location).Y); if (pos == -1) { return; } int selectedLine = FindResultsScintilla.LineFromPosition(pos); ScintillaNET_FindReplaceDialog.CharacterRange CharRange = _findAllResults[selectedLine]; Scintilla.SetSelection(CharRange.cpMin, CharRange.cpMax); Scintilla.ScrollCaret(); }
private void findPrevious() { if (this.txtFind.Text == string.Empty) { return; } if (_scintilla == null) { return; } ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.FindPrevious(this.txtFind.Text, true, _findReplace.Window.GetSearchFlags()); if (r.cpMin != r.cpMax) { _scintilla.SetSel(r.cpMin, r.cpMax); } MoveFormAwayFromSelection(); }