myproject.cs
来自「功能强大的记事本」· CS 代码 · 共 69 行
CS
69 行
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 + =
减小字号Ctrl + -
显示快捷键?