form4.cs

来自「简易文本编辑器 便于书写 适合初学者参考 也可进一步改进」· CS 代码 · 共 55 行

CS
55
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
        }
        public RichTextBox s1;
        public int start;
        private void button1_Click(object sender, EventArgs e)
        {
            string str1;
            str1 = textBox1.Text;
            if (str1 == "")
            {
                MessageBox.Show("请确认查找内容!", "异常警示");
            }
            else
            {
                start = s1.Find(str1, start, RichTextBoxFinds.MatchCase);
                if (start == -1)
                {
                    MessageBox.Show("已经查到文档的结尾!", "结束查找");
                    start = 0;
                    s1.Focus();

                }
                else
                {
                    start = start + str1.Length;
                    s1.Focus();
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Form4_Load(object sender, EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?