コード例 #1
0
        private void OnFind(FindEventArgs e)
        {
            var find = Find;

            if (find != null)
            {
                find(e);
            }
        }
コード例 #2
0
ファイル: frmDiff.cs プロジェクト: bhank/speediff
        void findDialog_Find(FindEventArgs e)
        {
            var stop = false;

            if (e.SearchLeft)
            {
                stop = FindInTextBox(rtbLeft, e.Text, e.UseRegularExpressions, e.CaseSensitive);
            }
            if (e.SearchRight && !stop)
            {
                stop = FindInTextBox(rtbRight, e.Text, e.UseRegularExpressions, e.CaseSensitive);
            }

            if (stop)
            {
                lastSuccessfulSearch = e.Text;
            }
            else
            {
                if (lastSuccessfulSearch == e.Text)
                {
                    MessageBox.Show("No more matches found; restarting from the top.", formTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    if (e.SearchLeft)
                    {
                        rtbLeft.SelectionStart = 0;
                    }
                    if (e.SearchRight)
                    {
                        rtbRight.SelectionStart = 0;
                    }

                    if (e.SearchLeft)
                    {
                        stop = FindInTextBox(rtbLeft, e.Text, e.UseRegularExpressions, e.CaseSensitive);
                    }
                    if (e.SearchRight && !stop)
                    {
                        stop = FindInTextBox(rtbRight, e.Text, e.UseRegularExpressions, e.CaseSensitive);
                    }
                }

                if (!stop)
                {
                    MessageBox.Show("No matches found.", formTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }