form1.cs
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 Editor
{
public partial class Form1 : Form
{
string filename = ""; //定义并初始化下文的文件名
public Form1()
{
InitializeComponent();
//初始化定时器
timer1.Enabled = true; //定时器的可见性
timer1.Interval = 1000; //定时器的时间间隔设置为1000ms
this.toolStripStatusLabel1.Text = "系统当前时间:" + DateTime.Now.ToString();
}
private void toolStripMenuItem6_Click(object sender, EventArgs e)
{
//点击此选项,关闭窗口并退出程序
this.Close();
Application.Exit();
}
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
//新建选项
richTextBox1.Clear(); //清空丰富文本区
filename = ""; //开始的文件名为空
this.Text = "无标题-EditorPrimer"; //初始化文件标题
}
private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
//打开文件选项,调用openFile对话框
openFileDialog1.Filter = "文本文件 | *.txt"; //设置文件类型过滤器