📄 myproject.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace MyDiary
{
public partial class Myproject : Form
{
public Myproject()
{
InitializeComponent();
}
private void 新建ToolStripMenuItem_Click(object sender, EventArgs e)
{
Diary2 objDiary2 = new Diary2();
objDiary2.MdiParent = this;
objDiary2.Show();
}
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog objOpenFileDialog = new OpenFileDialog();
objOpenFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
objOpenFileDialog.ShowDialog();
string fr = objOpenFileDialog.FileName;
Process.Start(fr);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void 保存ToolStripMenuItem1_Click(object sender, EventArgs e)
{
SaveFileDialog objSaveFileDialog = new SaveFileDialog();
objSaveFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
objSaveFileDialog.ShowDialog();
}
private void Myproject_Load(object sender, EventArgs e)
{
this.timer1.Start();
this.toolStripStatusLabel1.Text = DateTime.Now.ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.timer1.Interval = 1000;
this.toolStripStatusLabel1.Text = DateTime.Now.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -