資源簡介
windows form窗體控件編寫的記事本,具有各種記事本的相關功能,例如查找,替換,打印,頁面設置,保存等功能,以及常規的復制,黏貼功能。是學習windows form 窗體編程的基礎實驗

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
namespace?Text
{
????public?partial?class?Find?:?Form
????{
????????Form1?f1?=?new?Form1();
????????public?Find(Form1?fm)
????????{
????????????f1?=?fm;
????????????InitializeComponent();
????????}
????????private?void?Find_Load(object?sender?EventArgs?e)
????????{
????????????radioButton2.Checked?=?true;
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?(radioButton2.Checked?==?true)
????????????{
????????????????down(f1.richTextBox1?this.textBox1.Text?checkBox1.Checked);
????????????????f1.richTextBox1.Focus();
????????????}
????????????else?if?(radioButton1.Checked?==?true)
????????????{
????????????????up(f1.richTextBox1?this.textBox1.Text?checkBox1.Checked);
????????????????f1.richTextBox1.Focus();
????????????}
????????}
????????//向下查找
????????public?void?down(RichTextBox?text?string?test?bool?check)
????????{
????????????string?strDown?=?““;
????????????int?intCount?=?0i=0;
????????????if(check==false)??//不區分大小寫
????????????{
????????????????if?(text.SelectedText.ToUpper()?==?test.ToUpper())???//如果選中的文本等于需要替換的文本
????????????????{
????????????????????//從光標所在位置后一位開始截取后面的所有字符
????????????????????strDown?=?text.Text.Substring(text.Selectionstart?+?1?text.Text.Length?-?(text.Selectionstart+1));??
????????????????}
????????????????else
????????????????{
????????????????????//從光標所在位置開始截取后面的所有字符
????????????????????strDown?=?text.Text.Substring(text.Selectionstart?text.Text.Length?-?text.Selectionstart);
????????????????}
????????????????
????????????}
????????????else?if?(check?==?true)???//區分大小寫
????????????{
????????????????if?(text.SelectedText?==?test)??//如果選中的文本等于需要替換的文本
????????????????{
????????????????????//從光標所在位置后一位開始截取后面的所有字符
????????????????????strDown?=?text.Text.Substring(text.Selectionstart?+?1?text.Text.Length?-?(text.Selectionstart+1));
????????????????}
????????????????else
????????????????{
????????????????????//從光標所在位置開始截取后面的所有字符
????????????????????strDown?=?text.Text.Substring(text.Selectionstart??text.Text.Length?-?text.Selectionstart);
????????????????}
????????????}
????????????intCount?=?text.Text.Length?-?strDown.Length;??//存放除截取的字符數以外的字符數
?????????????//?i?+?test.Length(要查找的字符的長度)?的長度不得大于截取字符數的長度
????????????for?(i?=?0;?i+test.Length?<=?strDown.Length?;?i++)?
????????????{
????????????????if?(check?==?true)??//區分大小寫
????????????????{
????????????????????if?(strDown.Substring(i?test.Length)?==?test)??//截取的字符等于要查找的字符
????????????????????{
????????????????????????text.Selectionstart?=?i+intCount;???//設置光標的起始位置
????????????????????????text.SelectionLength?=?test.Length;???//設置文本的選定字符數
????????????????????????return;
????????????????????}
????????????????}
????????????????els
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-03-06?23:53??Text\
?????文件????????6793??2017-03-06?23:47??Text\QQ截圖20170306234653.jpg
?????文件???????21148??2017-03-06?23:53??Text\QQ截圖20170是.jpg
?????目錄???????????0??2017-03-06?23:52??Text\Text\
?????文件????????6579??2017-03-06?23:00??Text\Text\Find.Designer.cs
?????文件????????6656??2017-03-06?23:36??Text\Text\Find.cs
?????文件????????7764??2017-03-06?22:58??Text\Text\Find.resx
?????文件???????21221??2017-03-07?15:08??Text\Text\Form1.Designer.cs
?????文件????????4609??2017-03-07?15:08??Text\Text\Form1.cs
?????文件????????6825??2017-03-07?15:08??Text\Text\Form1.resx
?????文件????????2903??2017-03-06?23:57??Text\Text\Info.Designer.cs
?????文件?????????469??2017-03-06?23:56??Text\Text\Info.cs
?????文件????????6344??2017-03-06?23:56??Text\Text\Info.resx
?????文件?????????485??2017-03-01?11:06??Text\Text\Program.cs
?????目錄???????????0??2017-03-06?21:17??Text\Text\Properties\
?????文件????????1358??2017-03-01?10:01??Text\Text\Properties\AssemblyInfo.cs
?????文件????????3685??2017-03-06?23:53??Text\Text\Properties\Resources.Designer.cs
?????文件????????6769??2017-03-06?23:53??Text\Text\Properties\Resources.resx
?????文件????????1089??2017-03-01?10:01??Text\Text\Properties\Settings.Designer.cs
?????文件?????????249??2017-03-01?10:01??Text\Text\Properties\Settings.settings
?????文件????????6543??2017-03-06?23:32??Text\Text\Replace.Designer.cs
?????文件????????7282??2017-03-06?23:45??Text\Text\Replace.cs
?????文件????????7567??2017-03-06?23:32??Text\Text\Replace.resx
?????目錄???????????0??2017-03-06?23:53??Text\Text\Resources\
?????文件????????6793??2017-03-06?23:52??Text\Text\Resources\QQ截圖20170306234653.jpg
?????文件????????6793??2017-03-06?23:47??Text\Text\Resources\QQ截圖201703062346531.jpg
?????文件???????21148??2017-03-06?23:53??Text\Text\Resources\QQ截圖20170是.jpg
?????文件????????5186??2017-03-06?23:56??Text\Text\Text.csproj
?????文件????????8916??2017-03-04?14:39??Text\Text\ZiTi.Designer.cs
?????文件????????2769??2017-03-04?16:53??Text\Text\ZiTi.cs
?????文件????????5817??2017-03-04?14:39??Text\Text\ZiTi.resx
............此處省略61個文件信息
評論
共有 條評論