〖欢迎转载〗转载请注明出处
把 查找,替换,全部替换 三个button 的 Enabled 设置为 false ,f替换内容TextBox Enabled 也设置为false , CheckBox2 为选中....
在主窗体中 关联一个函数就可以了,主窗体关联如下: Form_Mxdr.RichTextBox .Name=txtInput;
/// <summary>获取 Form_Mxdr.RichTextBox<para> <para>
/// 获取 RichTextBox 的读写操作权限</para></para> </summary>
public RichTextBox RichTxtBox
{
get { return this.txtInput; }
set { this.txtInput = value; }
}
查找窗体代码: 向上查找无法区分大小写 ,全部替换只能替换查找内容限定区分出的大写或小写字母进行转换...
public partial class formFind : Form
{
public formFind()
{
InitializeComponent();
}
private void formFind_Load(object sender, EventArgs e)
{
radioButton2.Checked = true;
}
#region ***********全局变量*************
int start = 0;
int sun = 0;
int count = 0;
#endregion
#region =★*★*★= 四个 Button 点击事件 =★*★*★=
private void button1_Click(object sender, EventArgs e)
{
Form_Mxdr f1 = (Form_Mxdr)this.Owner;
RichTextBox rbox = f1.RichTxtBox;
string str = this.textBox1.Text;
if (this.checkBox1.Checked) //是否区分大小写
{
this.FindDownM(rbox, str);
}
else
{
if (this.radioButton2.Checked)
{
this.FindDown(rbox, str);
}
else
{
this.FindUp(rbox, str);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
string str0=this.textBox