最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
C#中怎么實(shí)現(xiàn)單詞本功能

今天就跟大家聊聊有關(guān)C#中怎么實(shí)現(xiàn)單詞本功能,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的長(zhǎng)壽網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

A版實(shí)現(xiàn)以下功能:

1.利用文件流讀取文本文件2.利用openfiledialog實(shí)現(xiàn)查找文件的功能3.存取文本文件路徑和顯示文本文件內(nèi)容的功能

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;  namespace WindowsFormsApp6{ public partial class Form1 : Form {  public Form1()  {   InitializeComponent();  }   private void button2_Click(object sender, EventArgs e)  {   textBox1.Clear();//每點(diǎn)擊一次選擇文件按鈕自動(dòng)清空文本框內(nèi)已經(jīng)打開的文件內(nèi)容   textBox2.Clear();//清空文件路徑的內(nèi)容   OpenFileDialog filename = new OpenFileDialog();//定義打開文件   filename.InitialDirectory = Application.StartupPath;//初始路徑   filename.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";//設(shè)置打開文件的類型   filename.FilterIndex = 2;//設(shè)置文件類型的顯示順序      if (filename.ShowDialog() == DialogResult.OK)   {    textBox2.Text = filename.FileName.ToString();//將路徑顯示在文本框    StreamReader sr = new StreamReader(filename.FileName, Encoding.Default);    //將文件通過(guò)stream流讀取    string content = sr.ReadToEnd();//把文件讀完存給content    string[] lines = content.Split('\n');//將文件內(nèi)容分割成一行一行存給數(shù)組    for (int i = 0; i < lines.Length; i++)    {      textBox1.Text += lines[i++]+"\n";       //List english = new List();     //List chinese = new List();     //string[] words = lines[i].Trim().Split('\t');     //if (words.Length < 2)     //continue;     //english.Add(words[0]);     //chinese.Add(words[1]);          }      sr.Close();   }  }   private void button1_Click(object sender, EventArgs e)  {   textBox1.Clear();//此處點(diǎn)擊返回按鈕同樣自動(dòng)清空文本框文件內(nèi)容   textBox2.Clear();//清除文件路徑內(nèi)容  } }}

看完上述內(nèi)容,你們對(duì)C#中怎么實(shí)現(xiàn)單詞本功能有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。


標(biāo)題名稱:C#中怎么實(shí)現(xiàn)單詞本功能
轉(zhuǎn)載注明:http://fisionsoft.com.cn/article/jpdeho.html