131 lines
4.1 KiB
C#
131 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace _19_8
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void 新建NToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Clear();
|
|
this.Text = "新建文档";
|
|
}
|
|
|
|
private void 打开OToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
|
openFileDialog1.InitialDirectory = @"C:/";
|
|
openFileDialog1.Filter = "rtf files (*.rtf) | *.rtf";
|
|
openFileDialog1.FilterIndex = 2;
|
|
openFileDialog1.RestoreDirectory = true;
|
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
richTextBox1.LoadFile(openFileDialog1.FileName);
|
|
}
|
|
}
|
|
|
|
private void 保存SToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
|
saveFileDialog1.InitialDirectory = @"C:/";
|
|
saveFileDialog1.Filter = "rtf files (*.rtf) | *.rtf";
|
|
saveFileDialog1.FilterIndex = 1;
|
|
saveFileDialog1.RestoreDirectory = true;
|
|
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
richTextBox1.SaveFile(saveFileDialog1.FileName);
|
|
}
|
|
}
|
|
|
|
private void 字体FToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
FontDialog fontDialog1 = new FontDialog();
|
|
fontDialog1.ShowColor = true;
|
|
fontDialog1.Font = richTextBox1.SelectionFont;
|
|
fontDialog1.Color = richTextBox1.SelectionColor;
|
|
if (fontDialog1.ShowDialog() != DialogResult.Cancel)
|
|
{
|
|
richTextBox1.SelectionFont = fontDialog1.Font;
|
|
richTextBox1.SelectionColor = fontDialog1.Color;
|
|
}
|
|
}
|
|
|
|
private void 剪切TToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Cut();
|
|
}
|
|
|
|
private void 复制CToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Copy();
|
|
}
|
|
|
|
private void 粘贴PToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Paste();
|
|
}
|
|
|
|
private void 帮助HToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
MessageBox.Show("11111111");
|
|
}
|
|
|
|
private void Form1_SizeChanged(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Width = this.Width - 35;
|
|
richTextBox1.Height = this.Height - 70;
|
|
}
|
|
|
|
private void 剪切XToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Cut();
|
|
}
|
|
|
|
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Copy();
|
|
}
|
|
|
|
private void 粘贴PToolStripMenuItem1_Click(object sender, EventArgs e)
|
|
{
|
|
richTextBox1.Paste();
|
|
}
|
|
|
|
private void 字体FToolStripMenuItem1_Click(object sender, EventArgs e)
|
|
{
|
|
FontDialog fontDialog1 = new FontDialog();
|
|
fontDialog1.ShowColor = true;
|
|
fontDialog1.Font = richTextBox1.SelectionFont;
|
|
fontDialog1.Color = richTextBox1.SelectionColor;
|
|
if (fontDialog1.ShowDialog() != DialogResult.Cancel)
|
|
{
|
|
richTextBox1.SelectionFont = fontDialog1.Font;
|
|
richTextBox1.SelectionColor = fontDialog1.Color;
|
|
}
|
|
}
|
|
|
|
private void 版本ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
AboutDialog Form2 = new AboutDialog();
|
|
Form2.ShowDialog();
|
|
}
|
|
}
|
|
}
|