日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

c# html文本编辑器,C#实现简单文本编辑器

發布時間:2023/11/27 C# 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c# html文本编辑器,C#实现简单文本编辑器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文實例為大家分享了C#實現簡單文本編輯器的具體代碼,供大家參考,具體內容如下

建立一個窗體文件,實現對文件的編輯保存和對txt文件的打開

界面設計:

程序源代碼:

//form1.cs

using 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.cs

using 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)

{

}

}

}

運行截圖

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

總結

以上是生活随笔為你收集整理的c# html文本编辑器,C#实现简单文本编辑器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

歡迎分享!

轉載請說明來源于"生活随笔",并保留原作者的名字。

本文地址:c# html文本编辑器,C#实现简单文本编辑器