private void txtFind_TextChanged(object sender, EventArgs e)
{
txtFind.BackColor = SystemColors.Window;
if (txtFind.Text == string.Empty)
return;
if (Scintilla == null)
return;
int pos = Math.Min(Scintilla.Caret.Position, Scintilla.Caret.Anchor);
Range r = Scintilla.FindReplace.Find(pos, Scintilla.TextLength, txtFind.Text, Scintilla.FindReplace.Window.GetSearchFlags());
if (r == null)
r = Scintilla.FindReplace.Find(0, pos, txtFind.Text, Scintilla.FindReplace.Window.GetSearchFlags());
if (r != null)
r.Select();
else
txtFind.BackColor = Color.Tomato;
moveFormAwayFromSelection();
}