📄 serch.cs
字号:
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 Serch : Form
{
private int pos = 0;
public Serch()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button2_Click(object sender, EventArgs e)
{
if (this.textBox1.Text != "")
{
Form1 f = (Form1)this.Owner;
if (f.richTextBox1.Text.Length >0)
{
if ((pos = f.richTextBox1.Text.IndexOf(textBox1.Text, pos)) == -1)
{
MessageBox.Show("没有找到");
pos = 0;
}
else
{
f.richTextBox1.Select(pos ,textBox1 .Text .Length );
pos = pos + textBox1.Text.Length;
f.Activate();
}
}
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
pos = 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -