📄 form1.cs
字号:
// toolBar1
//
this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton1,
this.toolBarButton2,
this.toolBarButton3,
this.toolBarButton4,
this.toolBarButton5,
this.toolBarButton6,
this.toolBarButton7,
this.toolBarButton8,
this.toolBarButton13,
this.toolBarButton10,
this.toolBarButton9,
this.toolBarButton11,
this.toolBarButton12,
this.toolBarButton15,
this.toolBarButton14,
this.toolBarButton16});
this.toolBar1.DropDownArrows = true;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Location = new System.Drawing.Point(0, 0);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(584, 28);
this.toolBar1.TabIndex = 1;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarButton1
//
this.toolBarButton1.DropDownMenu = this.contextMenu2;
this.toolBarButton1.ImageIndex = 0;
this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
this.toolBarButton1.ToolTipText = "新建";
//
// contextMenu2
//
this.contextMenu2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem22,
this.menuItem23,
this.menuItem24});
//
// menuItem22
//
this.menuItem22.Index = 0;
this.menuItem22.Text = "文本文档(&T)";
this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
//
// menuItem23
//
this.menuItem23.Index = 1;
this.menuItem23.Text = "图像文档(&G)";
this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
//
// menuItem24
//
this.menuItem24.Index = 2;
this.menuItem24.Text = "动画文档(*A)";
this.menuItem24.Click += new System.EventHandler(this.menuItem24_Click);
//
// toolBarButton2
//
this.toolBarButton2.ImageIndex = 1;
this.toolBarButton2.ToolTipText = "打开";
//
// toolBarButton3
//
this.toolBarButton3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton4
//
this.toolBarButton4.ImageIndex = 2;
this.toolBarButton4.ToolTipText = "保存";
//
// toolBarButton5
//
this.toolBarButton5.ImageIndex = 3;
this.toolBarButton5.ToolTipText = "全部保存";
//
// toolBarButton6
//
this.toolBarButton6.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton7
//
this.toolBarButton7.ImageIndex = 4;
this.toolBarButton7.ToolTipText = "剪切";
//
// toolBarButton8
//
this.toolBarButton8.ImageIndex = 5;
this.toolBarButton8.ToolTipText = "复制";
//
// toolBarButton13
//
this.toolBarButton13.ImageIndex = 9;
this.toolBarButton13.ToolTipText = "粘贴";
//
// toolBarButton10
//
this.toolBarButton10.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton9
//
this.toolBarButton9.ImageIndex = 6;
this.toolBarButton9.ToolTipText = "搜索";
//
// toolBarButton11
//
this.toolBarButton11.ImageIndex = 7;
this.toolBarButton11.ToolTipText = "帮助";
//
// toolBarButton12
//
this.toolBarButton12.ImageIndex = 8;
this.toolBarButton12.ToolTipText = "打印";
//
// toolBarButton15
//
this.toolBarButton15.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton14
//
this.toolBarButton14.ImageIndex = 10;
this.toolBarButton14.ToolTipText = "屏幕键盘";
//
// toolBarButton16
//
this.toolBarButton16.ImageIndex = 11;
this.toolBarButton16.ToolTipText = "放大镜";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// statusBar1
//
this.statusBar1.Font = new System.Drawing.Font("楷体_GB2312", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.statusBar1.Location = new System.Drawing.Point(0, 519);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2,
this.statusBarPanel3,
this.statusBarPanel4});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(584, 22);
this.statusBar1.TabIndex = 2;
this.statusBar1.TabStop = true;
this.toolTip1.SetToolTip(this.statusBar1, "状态栏 ");
// this.statusBar1.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar1_PanelClick);
// //
// statusBarPanel1
//
this.statusBarPanel1.Width = 200;
//
// statusBarPanel2
//
this.statusBarPanel2.Width = 200;
//
// statusBarPanel3
//
this.statusBarPanel3.ToolTipText = "鼠标横坐标 ";
//
// statusBarPanel4
//
this.statusBarPanel4.ToolTipText = "鼠标纵坐标";
//
// openFileDialog1
//
this.openFileDialog1.DefaultExt = "txt";
this.openFileDialog1.Filter = "所有文件(*.*)|*.*|文本文件(*.txt)|*.txt";
this.openFileDialog1.RestoreDirectory = true;
this.openFileDialog1.ShowHelp = true;
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem15,
this.menuItem16,
this.menuItem17,
this.menuItem18});
//
// menuItem15
//
this.menuItem15.Index = 0;
this.menuItem15.Text = "保存(&S)";
this.menuItem15.Click += new System.EventHandler(this.menuItem15_Click);
//
// menuItem16
//
this.menuItem16.Index = 1;
this.menuItem16.Text = "复制(&C)";
this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click);
//
// menuItem17
//
this.menuItem17.Index = 2;
this.menuItem17.Text = "粘贴(&P)";
this.menuItem17.Click += new System.EventHandler(this.menuItem17_Click);
//
// menuItem18
//
this.menuItem18.Index = 3;
this.menuItem18.Text = "剪切(&T)";
this.menuItem18.Click += new System.EventHandler(this.menuItem18_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// printDialog1
//
this.printDialog1.AllowSelection = true;
this.printDialog1.AllowSomePages = true;
this.printDialog1.Document = this.printDocument1;
this.printDialog1.PrintToFile = true;
this.printDialog1.ShowHelp = true;
//
// printDocument1
//
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
//
// process1
//
this.process1.SynchronizingObject = this;
//
// fontDialog1
//
this.fontDialog1.ScriptsOnly = true;
this.fontDialog1.ShowApply = true;
this.fontDialog1.ShowColor = true;
this.fontDialog1.ShowHelp = true;
//
// timer2
//
this.timer2.Enabled = true;
this.timer2.Interval = 500;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// linkLabel1
//
this.linkLabel1.BackColor = System.Drawing.SystemColors.Control;
this.linkLabel1.Cursor = System.Windows.Forms.Cursors.Hand;
this.linkLabel1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.linkLabel1.LinkColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
this.linkLabel1.Location = new System.Drawing.Point(328, 8);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(80, 16);
this.linkLabel1.TabIndex = 4;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "南阳理工学院";
this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.linkLabel1.VisitedLinkColor = System.Drawing.Color.Green;
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// MDIEditor
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(584, 541);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.toolBar1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsMdiContainer = true;
this.Menu = this.mainMenu1;
this.Name = "MDIEditor";
this.Text = "MDIEditor";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Closing += new System.ComponentModel.CancelEventHandler(this.MDIEditor_Closing);
// this.Load += new System.EventHandler(this.MDIEditor_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.MDIEditor_Paint);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MDIEditor_MouseMove);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel4)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new MDIEditor());
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
MDIChild child = new MDIChild();
child.MdiParent=this;
child.Show();
this.statusBarPanel2.Text="新建文件";
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
this.openFileDialog1.ShowDialog();
MDIChild child=new MDIChild();
child.Text=this.openFileDialog1.FileName;
child.MdiParent=this;
child.richTextBox1.LoadFile(this.openFileDialog1.FileName);
child.Show();
}
this.statusBarPanel2.Text="打开文件:"+this.openFileDialog1.FileName;
this.Text="文件的路径:"+this.openFileDialog1.FileName;
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
DialogResult result;
result=MessageBox.Show("确定退出吗?","确定退出",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question);
if(result==DialogResult.Yes)
{
this.Close();
}
this.statusBarPanel2.Text="关闭当前窗口";
}
// 窗体的排列方式
// 水平平铺
private void menuItem9_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileHorizontal);
}
// 排列
private void menuItem10_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.ArrangeIcons);
}
// 层叠
private void menuItem12_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.Cascade);
}
// 垂直平铺
private void menuItem14_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileVertical);
}
// 工具栏的显示和隐藏
private void menuItem6_Click(object sender, System.EventArgs e)
{
if(this.menuItem6.Checked)
{
toolBar1.Dock=DockStyle.None;
toolBar1.Hide();
this.menuItem6.Checked=false;
}
else
{
this.toolBar1.Dock=DockStyle.Top;
this.toolBar1.Show();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -