コード例 #1
0
ファイル: FindDialog.cs プロジェクト: anthrax3/xacc.ide
        private void button1_Click(object sender, System.EventArgs e)
        {
            button1.BackColor = SystemColors.Control;
            RichTextBoxFinds options = 0;
            int end   = atb.TextLength - 1;
            int start = atb.SelectionStart + atb.SelectionLength;

            if (checkBox1.Checked)
            {
                options |= RichTextBoxFinds.MatchCase;
            }
            if (checkBox2.Checked)
            {
                options |= RichTextBoxFinds.WholeWord;
            }
            if (checkBox3.Checked)
            {
                options |= RichTextBoxFinds.Reverse;
                end      = start - 1;
                start    = 0;
            }
            if (checkBox4.Checked)
            {
                options |= RichTextBoxFinds.NoHighlight;
            }

            int    pos;
            string pat = lastfind = comboBox1.Text;

            pos = atb.Find(pat, start, end, options);
            if (pos != -1)
            {
                atb.Select(pos, pat.Length);
                atb.ScrollToCaret();
            }
            else
            {
                button1.Enabled = false;
            }
        }