- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
查找和替换.cs
资源名称:Notebook.rar [点击查看]
上传用户:hueiseng
上传日期:2022-07-26
资源大小:156k
文件大小:4k
源码类别:
C#编程
开发平台:
Visual C++
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace 笔记本
- {
- public partial class 查找 : Form
- {
- static int findplace = 0;
- public 查找()
- {
- InitializeComponent();
- }
- public string note
- {
- get
- {
- return textBox1.Text;
- }
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- if (textBox1.Text.Length > 0)
- button1.Enabled = true;
- else
- button1.Enabled = false;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Form1 f1 = (Form1)this.Owner;
- f1.Activate();
- if (textBox1.Text.Length > 0)
- {
- if (!checkBox1.Checked)
- {
- if (radioButton1.Checked)
- {
- findplace = f1.richTextBox1.SelectionStart - 1;
- if (findplace < 0)
- {
- MessageBox.Show("无法找到搜索项!");
- findplace = 0;
- }
- else
- {
- findplace = f1.richTextBox1.Text.LastIndexOf(textBox1.Text, findplace);
- f1.richTextBox1.Select(findplace, textBox1.Text.Length);
- }
- }
- if (radioButton2.Checked)
- {
- findplace = f1.richTextBox1.Text.IndexOf(textBox1.Text, findplace);
- if (findplace == -1)
- {
- MessageBox.Show("无法找到搜索项!");
- findplace = f1.richTextBox1.SelectionStart;
- }
- else
- {
- f1.richTextBox1.Select(findplace, textBox1.Text.Length);
- findplace = f1.richTextBox1.SelectionStart + textBox1.Text.Length;
- }
- }
- }
- else
- {
- if (radioButton1.Checked)
- {
- findplace = f1.richTextBox1.SelectionStart - 1;
- if (findplace < 0)
- {
- MessageBox.Show("无法找到搜索项!");
- findplace = 0;
- }
- else
- {
- findplace = f1.richTextBox1.Text.LastIndexOf(textBox1.Text, findplace, StringComparison.OrdinalIgnoreCase);
- f1.richTextBox1.Select(findplace, textBox1.Text.Length);
- }
- }
- if (radioButton2.Checked)
- {
- findplace = f1.richTextBox1.Text.IndexOf(textBox1.Text, findplace, StringComparison.OrdinalIgnoreCase);
- if (findplace == -1)
- {
- MessageBox.Show("无法找到搜索项!");
- findplace = f1.richTextBox1.SelectionStart;
- }
- else
- {
- f1.richTextBox1.Select(findplace, textBox1.Text.Length);
- findplace = f1.richTextBox1.SelectionStart + textBox1.Text.Length;
- }
- }
- }
- }
- }
- }
- }