📄 mdichild.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing.Printing;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace 多文档
{
/// <summary>
/// MDIChild 的摘要说明。
/// </summary>
public class MDIChild : System.Windows.Forms.Form
{
public System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem8;
private System.Windows.Forms.MenuItem menuItem9;
private System.Windows.Forms.MenuItem menuItem10;
private System.Windows.Forms.MenuItem menuItem11;
private System.Drawing.Printing.PrintDocument printDocument1;
private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
private System.Windows.Forms.PrintPreviewDialog printPreviewDialog1;
private System.Windows.Forms.PrintDialog printDialog1;
private System.Windows.Forms.PrintPreviewControl printPreviewControl1;
public ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem copy;
private System.Windows.Forms.MenuItem paste;
private System.Windows.Forms.MenuItem cut;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private IContainer components;
private System.Windows.Forms.MenuItem menuItem12;
private System.Windows.Forms.MenuItem seleAll;
private System.Windows.Forms.MenuItem menuItem13;
private System.Windows.Forms.MenuItem Del;
private System.Windows.Forms.MenuItem undo;
private System.Windows.Forms.MenuItem menuItem14;
private System.Windows.Forms.MenuItem Un;
private System.Windows.Forms.MenuItem menuItemEdit;
private StringReader MySReader;
public MDIChild()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MDIChild));
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItemEdit = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.menuItem14 = new System.Windows.Forms.MenuItem();
this.menuItem12 = new System.Windows.Forms.MenuItem();
this.Un = new System.Windows.Forms.MenuItem();
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
this.printDialog1 = new System.Windows.Forms.PrintDialog();
this.printPreviewControl1 = new System.Windows.Forms.PrintPreviewControl();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.copy = new System.Windows.Forms.MenuItem();
this.paste = new System.Windows.Forms.MenuItem();
this.cut = new System.Windows.Forms.MenuItem();
this.seleAll = new System.Windows.Forms.MenuItem();
this.menuItem13 = new System.Windows.Forms.MenuItem();
this.Del = new System.Windows.Forms.MenuItem();
this.undo = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(424, 421);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
this.richTextBox1.SelectionChanged += new System.EventHandler(this.richTextBox1_SelectionChanged);
this.richTextBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.richTextBox1_MouseUp);
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItemEdit});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3,
this.menuItem4,
this.menuItem5,
this.menuItem6});
this.menuItem1.Text = "文件(&F)";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
this.menuItem2.Text = "保存(&S)";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "页面设置";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 2;
this.menuItem4.Text = "打印设置";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
//
// menuItem5
//
this.menuItem5.Index = 3;
this.menuItem5.Text = "打印预览";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem6
//
this.menuItem6.Index = 4;
this.menuItem6.Text = "打印(&P)";
this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
//
// menuItemEdit
//
this.menuItemEdit.Index = 1;
this.menuItemEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem8,
this.menuItem9,
this.menuItem10,
this.menuItem11,
this.menuItem14,
this.menuItem12,
this.Un});
this.menuItemEdit.Text = "编辑";
this.menuItemEdit.Click += new System.EventHandler(this.menuItemEdit_Click);
this.menuItemEdit.Popup += new System.EventHandler(this.menuItemEdit_Popup);
//
// menuItem8
//
this.menuItem8.Index = 0;
this.menuItem8.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
this.menuItem8.Text = "剪切(&T) Ctrl+X";
this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
//
// menuItem9
//
this.menuItem9.Index = 1;
this.menuItem9.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
this.menuItem9.Text = "拷贝(&C) Ctrl+C";
this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
//
// menuItem10
//
this.menuItem10.Index = 2;
this.menuItem10.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
this.menuItem10.Text = "粘贴(&P) Ctrl+V";
this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
//
// menuItem11
//
this.menuItem11.Index = 3;
this.menuItem11.Shortcut = System.Windows.Forms.Shortcut.Del;
this.menuItem11.Text = "删除(&L) Del";
this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
//
// menuItem14
//
this.menuItem14.Index = 4;
this.menuItem14.Text = "-";
//
// menuItem12
//
this.menuItem12.Index = 5;
this.menuItem12.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
this.menuItem12.Text = "全选(&A) Ctrl+A";
this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click_1);
//
// Un
//
this.Un.Index = 6;
this.Un.Shortcut = System.Windows.Forms.Shortcut.CtrlZ;
this.Un.Text = "撤销(&U) Ctrl+Z";
this.Un.Click += new System.EventHandler(this.Un_Click);
//
// pageSetupDialog1
//
this.pageSetupDialog1.Document = this.printDocument1;
this.pageSetupDialog1.ShowHelp = true;
//
// saveFileDialog1
//
this.saveFileDialog1.DefaultExt = "txt";
this.saveFileDialog1.Filter = "所有文件(*.*)|*.*|文本文件(*.txt)|*.txt|C#文件(*.cs)|(*.cs)";
this.saveFileDialog1.RestoreDirectory = true;
this.saveFileDialog1.ShowHelp = true;
//
// printPreviewDialog1
//
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
this.printPreviewDialog1.Document = this.printDocument1;
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.UseAntiAlias = true;
this.printPreviewDialog1.Visible = false;
//
// printDialog1
//
this.printDialog1.Document = this.printDocument1;
this.printDialog1.PrintToFile = true;
this.printDialog1.ShowHelp = true;
//
// printPreviewControl1
//
this.printPreviewControl1.AutoZoom = false;
this.printPreviewControl1.Document = this.printDocument1;
this.printPreviewControl1.Location = new System.Drawing.Point(430, 321);
this.printPreviewControl1.Name = "printPreviewControl1";
this.printPreviewControl1.Size = new System.Drawing.Size(78, 100);
this.printPreviewControl1.TabIndex = 1;
this.printPreviewControl1.Zoom = 0.0718562874251497;
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.copy,
this.paste,
this.cut,
this.seleAll,
this.menuItem13,
this.Del,
this.undo});
//
// copy
//
this.copy.Index = 0;
this.copy.Text = "复制(&C)";
this.copy.Click += new System.EventHandler(this.menuItem12_Click);
//
// paste
//
this.paste.Index = 1;
this.paste.Text = "粘贴(&P)";
this.paste.Click += new System.EventHandler(this.paste_Click);
//
// cut
//
this.cut.Index = 2;
this.cut.Text = "剪切(&T)";
this.cut.Click += new System.EventHandler(this.cut_Click);
//
// seleAll
//
this.seleAll.Index = 3;
this.seleAll.Text = "全选(&A)";
this.seleAll.Click += new System.EventHandler(this.seleAll_Click);
//
// menuItem13
//
this.menuItem13.Index = 4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -