欢迎来到天天文库
浏览记录
ID:37708694
大小:83.94 KB
页数:24页
时间:2019-05-29
《c#.net写Windows记事本源代码(访写)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Windows记事本源代码使用C#.net编写主界面:(Form1)使用的组件:主界面源码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;usingSystem.Drawing.Printing;namespace记事本{publicpart
2、ialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoid状态栏ToolStripMenuItem_Click(objectsender,EventArgse){if(状态栏ToolStripMenuItem.Checked==false){状态栏ToolStripMenuItem.Checked=true;statusStrip1.Visible=true;}else{状态栏ToolStripMenuItem.Checked=false;statusStrip1.Visible=
3、false;}}privatevoid自定义CToolStripMenuItem_Click(objectsender,EventArgse){if(自定义CToolStripMenuItem.Checked==false){自定义CToolStripMenuItem.Checked=true;richTextBox1.WordWrap=true;richTextBox1.ScrollBars=RichTextBoxScrollBars.ForcedVertical;}else{自定义CToolStripMenuItem.Checked=false;ric
4、hTextBox1.WordWrap=false;richTextBox1.ScrollBars=RichTextBoxScrollBars.ForcedBoth;}}privatevoid选项OToolStripMenuItem_Click(objectsender,EventArgse){FontDialogdlg=newFontDialog();dlg.ShowEffects=true;dlg.ShowColor=true;dlg.Color=richTextBox1.ForeColor;dlg.Font=richTextBox1.Font;if(d
5、lg.ShowDialog()==DialogResult.OK){richTextBox1.Font=dlg.Font;richTextBox1.ForeColor=dlg.Color;}}privatevoid复制CToolStripMenuItem_Click(objectsender,EventArgse){if(richTextBox1.SelectedText.Length>0){this.复制CToolStripMenuItem.Enabled=true;richTextBox1.Copy();}else{this.复制CToolStripM
6、enuItem.Enabled=false;}}privatevoid剪切TToolStripMenuItem_Click(objectsender,EventArgse){if(richTextBox1.SelectedText.Length>0){this.剪切TToolStripMenuItem.Enabled=true;richTextBox1.Cut();}else{this.剪切TToolStripMenuItem.Enabled=false;}}privatevoidrichTextBox1_TextChanged(objectsender,
7、EventArgse)//状态栏{bsave=false;introw=richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart)+1;intstart=richTextBox1.GetFirstCharIndexOfCurrentLine();strings=richTextBox1.Text.Substring(start,richTextBox1.SelectionStart-start);intcol=s.Length+1;//intst=richTextBox1.Selection
8、Start;//introw=richTextBox1.GetLi
此文档下载收益归作者所有