C#窗体程序--简单文本编辑器
来源:互联网 发布:淘宝上1000多的苹果6s 编辑:程序博客网 时间:2024/05/21 10:13
建立一个窗体文件,实现对文件的编辑保存和对txt文件的打开
界面设计:
程序源代码:
//form1.csusing 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 Txt_EditApp{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //Open file 菜单选项 private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.Filter = "txt files(*.txt)|*.txt"; if(openFileDialog1.ShowDialog()==DialogResult.OK) { richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.PlainText); } } //Save file 菜单选项 private void saveFileToolStripMenuItem_Click(object sender, EventArgs e) { saveFileDialog1.Filter = "txt files(*.txt)|*.txt"; if(saveFileDialog1.ShowDialog()==DialogResult.OK) { richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText); } } //exit file 菜单选项 private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Close(); } //About 菜单选项 private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { Form2 frm = new Form2(); frm.ShowDialog(); } }}//form2.csusing 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 Txt_EditApp{ public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void label2_Click(object sender, EventArgs e) { } }}
运行截图
阅读全文
0 0
- C#窗体程序--简单文本编辑器
- C#简单窗体聊天程序
- C#做一个简单的窗体程序
- 东秦C#课设002-简单的文本编辑器
- (七)C#之WinForm程序设计-简单版文本编辑器
- c#文本编辑器
- C# 文本编辑器
- 简单得文本编辑器
- python简单文本编辑器
- 简单的文本编辑器
- 简单文本编辑器
- 简单的文本编辑器
- 简单文本编辑器
- Qt5主窗体程序: 文本编辑器的实现(Qt5开发及实例)
- Qt5主窗体程序: 文本编辑器的实现(Qt5开发及实例)
- C#基础:用记事本编写简单WinForm窗体程序
- [C#]MDI窗体之rtf文本编辑器
- Python 窗体(tkinter)文本编辑器(Text)
- stl中set相关算法
- myeclipse10.7导出war包时出错解决办法
- Mac环境查看andrion sdk 路径
- 欢迎使用CSDN-markdown编辑器
- 网站进行SEO优化涉及的要素很多
- C#窗体程序--简单文本编辑器
- 高二&高一&初三模拟赛27 总结
- 理解OAuth 2.0 流程
- 如何使用jQuery刷新当前页面
- Go语言备忘录:net/http包的使用模式和源码解析
- 微信扫码登陆整合shiro 跨域ajax对cookie处理
- Git 的origin和master分析
- Linux防火墙介绍
- 配置C3P0数据源