c#创建记事本

新建窗体应用程序

创建菜单栏:menuStrip
创建工具栏: toolstrip
创建状态栏:statusstrip

工具栏新建按钮buttonn


属性image可改为自定义图片,text可添加文字,displaystyle设置显示图片或者文字
textimagerelation属性可定义文字与图片的关系


属性image可改为自定义图片,text可添加文字,displaystyle设置显示图片或者文字
textimagerelation属性可定义文字与图片的关系

新建textbox,
dock属性

菜单栏中的设置

复制选择事件:click
textBox1.Copy();

粘贴选择事件:click
粘贴textBox1.Paste();

打开 选择事件:click

if (DialogResult.OK == openFileDialog1.ShowDialog())
        {

             var fname = openFileDialog1.FileName;
           StringBuilder sb = new StringBuilder();
           using (StreamReader sr = new StreamReader(fname))
           {
               string line;
               while ((line = sr.ReadLine())!=null)
               {
                   sb.AppendLine(line);
               }
           }

           textBox1.Text = sb.ToString();
         //   MessageBox.Show(openFileDialog1.FileName);

        }

保存 选择事件:click

if (DialogResult.OK == saveFileDialog1.ShowDialog())

            {

                var filename = saveFileDialog1.FileName;

            //   StringBuilder sb = new StringBuilder();

               using (StreamWriter sw = new StreamWriter(filename))

               {

                   sw.WriteLine(textBox1.Text);

               }
          MessageBox.Show("保存成功");
上一篇 使用可道云KodExplorer在linux搭建个人云盘
下一篇 Linux修改SSH端口号
ZYX

ZYX管理员

无论你遇见谁他都是你生命中该出现的 绝非偶然

本月创作热力图

目录
文章列表
1 Linux实训7
Linux实训7
2
Linux-NTP服务器
Linux-NTP服务器
3
Linux-DHCP服务器的搭建
Linux-DHCP服务器的搭建
4
Linux-网络调试和进程管理
Linux-网络调试和进程管理
5
CACTI监控只能查看一天数据,不能显示其他时间解决方法
CACTI监控只能查看一天数据,不能显示其他时间解决方法