(注:那个常用工具栏里的字体、字号、字符集不能用) 主窗体里全部代码: 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; using System.IO; using System.Web; namespace NOTEBOOK { public partial class Form1 : Form { Find find = new Find(); replace replace = new replace(); public Form1() { InitializeComponent(); find.Owner = this; replace.Owner = this; for (int i = 0; i <= System.Drawing.FontFamily.Families.Length - 1; i++) { this.toolStripComboBox1.Items.Add(System.Drawing.FontFamily.Families[i].Name); } } private void Form1_Load(object sender, EventArgs e) { //窗体加载 timer1.Enabled = true; DateTime now = DateTime.Now; time.Text = now.ToLongDateString() + now.ToLongTimeString(); } private void timer1_Tick(object sender, EventArgs e) { //控制时间 timer1.Enabled = true; DateTime now = DateTime.Now; time.Text = now.ToLongDateString() + now.ToLongTimeString(); } ///
/// 新建菜单 /// ///
///
private void 新建NToolStripMenuItem_Click(object sender, EventArgs e) { if (richTextBox1.Modified == true)//判断当前文本是否处于编辑状态 { DialogResult r; r = MessageBox.Show("您是否将更改保存到 文档 吗?", "写字板", MessageBoxButtons.YesNoCancel, MessageBoxIcon.None); if (r == DialogResult.Yes) { 保存SToolStripMenuItem_Click(sender, e); richTextBox1.Clear(); this.Text = "新建-写字板";//标题名称 } else if (r == DialogResult.No) { richTextBox1.Clear(); this.Text = "新建-写字板"; } } else { richTextBox1.Clear(); this.Text = "新建-写字板"; richTextBox1.Modified = false; } } private void 打开OToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog 打开 = new OpenFileDialog(); 打开....