📄 form1.cs
字号:
this.menuGeshi.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuBeijingyanse,
this.menuZiti});
this.menuGeshi.Text = "格式(&O)";
//
// menuBeijingyanse
//
this.menuBeijingyanse.Index = 0;
this.menuBeijingyanse.Text = "设置颜色(&C)";
this.menuBeijingyanse.Click += new System.EventHandler(this.menuZhidonghuanhang_Click);
//
// menuZiti
//
this.menuZiti.Index = 1;
this.menuZiti.MdiList = true;
this.menuZiti.Text = "设置字体(&F)...";
this.menuZiti.Click += new System.EventHandler(this.menuZiti_Click);
//
// menuBangzhu
//
this.menuBangzhu.Index = 4;
this.menuBangzhu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuGuanyuzhuti,
this.menuGuanyujishiben});
this.menuBangzhu.Text = "帮助(&H)";
//
// menuGuanyuzhuti
//
this.menuGuanyuzhuti.Index = 0;
this.menuGuanyuzhuti.ShowShortcut = false;
this.menuGuanyuzhuti.Text = "关于主题(&H)";
this.menuGuanyuzhuti.Click += new System.EventHandler(this.menuGuanyuzhuti_Click);
//
// menuGuanyujishiben
//
this.menuGuanyujishiben.Index = 1;
this.menuGuanyujishiben.Text = "关于记事本(&A)";
this.menuGuanyujishiben.Click += new System.EventHandler(this.menuGuanyujishiben_Click);
//
// imageList1
//
this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth4Bit;
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.AllowDrop = true;
this.statusBar1.Location = new System.Drawing.Point(0, 293);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(472, 24);
this.statusBar1.TabIndex = 2;
this.statusBar1.Text = " girl:06计软—蒋枝枝";
this.statusBar1.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar1_PanelClick);
//
// toolBarButton1
//
this.toolBarButton1.ImageIndex = 0;
this.toolBarButton1.ToolTipText = "新建";
//
// toolBarButton2
//
this.toolBarButton2.ImageIndex = 1;
this.toolBarButton2.ToolTipText = "打开";
//
// toolBarButton3
//
this.toolBarButton3.ImageIndex = 2;
this.toolBarButton3.ToolTipText = "保存";
//
// toolBarButton4
//
this.toolBarButton4.ImageIndex = 3;
this.toolBarButton4.ToolTipText = "剪切";
//
// toolBarButton5
//
this.toolBarButton5.ImageIndex = 4;
this.toolBarButton5.ToolTipText = "复制";
//
// toolBarButton8
//
this.toolBarButton8.ImageIndex = 5;
this.toolBarButton8.ToolTipText = "粘贴";
//
// toolBarButton7
//
this.toolBarButton7.ImageIndex = 6;
this.toolBarButton7.ToolTipText = "帮助";
//
// 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.toolBarButton8,
this.toolBarButton7});
this.toolBar1.ButtonSize = new System.Drawing.Size(23, 22);
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(472, 28);
this.toolBar1.TabIndex = 0;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// richTextBox1
//
this.richTextBox1.AllowDrop = true;
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.AutoSize = true;
this.richTextBox1.ContextMenu = this.contextMenu1;
this.richTextBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(0, 32);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
this.richTextBox1.Size = new System.Drawing.Size(474, 256);
this.richTextBox1.TabIndex = 3;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuChexiao2,
this.menuFengexian6,
this.menuJianqie2,
this.menuFuzhi2,
this.menuNiantie2,
this.menuShanchu2,
this.menuFengexian7,
this.menuQuanxuan2});
//
// menuChexiao2
//
this.menuChexiao2.Index = 0;
this.menuChexiao2.Shortcut = System.Windows.Forms.Shortcut.CtrlU;
this.menuChexiao2.ShowShortcut = false;
this.menuChexiao2.Text = "撤消(&U)";
this.menuChexiao2.Click += new System.EventHandler(this.menuChexiao2_Click);
//
// menuFengexian6
//
this.menuFengexian6.Index = 1;
this.menuFengexian6.Text = "-";
//
// menuJianqie2
//
this.menuJianqie2.Index = 2;
this.menuJianqie2.Shortcut = System.Windows.Forms.Shortcut.CtrlT;
this.menuJianqie2.ShowShortcut = false;
this.menuJianqie2.Text = "剪切(&T)";
this.menuJianqie2.Click += new System.EventHandler(this.menuJianqie2_Click);
//
// menuFuzhi2
//
this.menuFuzhi2.Index = 3;
this.menuFuzhi2.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
this.menuFuzhi2.ShowShortcut = false;
this.menuFuzhi2.Text = "复制(&C)";
this.menuFuzhi2.Click += new System.EventHandler(this.menuFuzhi2_Click);
//
// menuNiantie2
//
this.menuNiantie2.Index = 4;
this.menuNiantie2.Shortcut = System.Windows.Forms.Shortcut.CtrlP;
this.menuNiantie2.ShowShortcut = false;
this.menuNiantie2.Text = "粘贴(&P)";
this.menuNiantie2.Click += new System.EventHandler(this.menuNiantie2_Click);
//
// menuShanchu2
//
this.menuShanchu2.Index = 5;
this.menuShanchu2.Shortcut = System.Windows.Forms.Shortcut.CtrlL;
this.menuShanchu2.ShowShortcut = false;
this.menuShanchu2.Text = "删除(&L)";
this.menuShanchu2.Click += new System.EventHandler(this.menuShanchu2_Click);
//
// menuFengexian7
//
this.menuFengexian7.Index = 6;
this.menuFengexian7.Text = "-";
//
// menuQuanxuan2
//
this.menuQuanxuan2.Index = 7;
this.menuQuanxuan2.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
this.menuQuanxuan2.ShowShortcut = false;
this.menuQuanxuan2.Text = "全选(&A)";
this.menuQuanxuan2.Click += new System.EventHandler(this.menuItem5_Click);
//
// openFileDialog1
//
this.openFileDialog1.Filter = "文本文档(*.txt)|*.txt|所有文件|*.*";
this.openFileDialog1.Title = "快乐打开";
//
// saveFileDialog1
//
this.saveFileDialog1.Filter = "文本文档(*.txt)|*.txt|所有文件|*.*";
this.saveFileDialog1.InitialDirectory = "C:\\Documents and Settings\\user\\My Documents";
this.saveFileDialog1.Title = "快乐保存";
//
// notifyIcon1
//
this.notifyIcon1.ContextMenu = this.contextMenu1;
this.notifyIcon1.Text = "notifyIcon1";
this.notifyIcon1.Visible = true;
//
// fontDialog1
//
this.fontDialog1.ShowApply = true;
this.fontDialog1.ShowColor = true;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(472, 317);
this.ContextMenu = this.contextMenu1;
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.toolBar1);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "写字板";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
} #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { int imageList1=e.Button.ImageIndex; if(imageList1==0) { menuXinjian_Click(sender,e); } if(imageList1==1) { menuDakai_Click(sender,e); } if(imageList1==2) { menuBaocun_Click(sender,e); } if(imageList1==3) { richTextBox1.Cut(); } if(imageList1==4) { richTextBox1.Copy(); } if(imageList1==5) { richTextBox1.Paste(); } if(imageList1==6) { bangzhu(); } } private void richTextBox1_TextChanged(object sender, System.EventArgs e) { } private void statusBar1_PanelClick(object sender, System.Windows.Forms.StatusBarPanelClickEventArgs e) { } private void menuDakai_Click(object sender, System.EventArgs e) { System.Windows.Forms.DialogResult yzResult; string yzmsg; string m_strFileName=""; string m_strTemp=""; statusBar1.Text="打开中..."; if(richTextBox1.Text!="") {//如果rcihTextBox中有文本 if(ModifiedFlag==true) {//如果该文本被修改过,就提示是否保存文件 yzmsg="文件"+FileName+"是否保存该文件?\n"; yzResult=MessageBox.Show(this,yzmsg,"写字板",System.Windows.Forms.MessageBoxButtons.YesNoCancel,System.Windows.Forms.MessageBoxIcon.Exclamation,System.Windows.Forms.MessageBoxDefaultButton.Button1); if(yzResult==DialogResult.Yes) {//如果保存的对话框选择的结果为Yes,则保存文件 if(IsSavedFlag==true) {//如果已经保存过,调用保存文件菜单的PerformClick方法 menuBaocun.PerformClick(); } else {//如果还没有保存过,调用另存为文件菜单的PerformClick方法 menuLingcunwei.PerformClick(); } } if(yzResult==DialogResult.Cancel) {//如果保存的对话框选择的结果为Cancel return; } } } openFileDialog1.Filter="文本文件(*.txt)|*.txt";//设置文件过滤器 openFileDialog1.FileName="";//初始化文件名变量 //弹出打开文件对话框
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -