E企盈营销工具技术服务商 热线:4006-838-530

简体字转换繁体字的winfrom小程序

E企盈直播平台营销卖货系统

这是一个可以把输入的简体字转换成繁体字的小东西。 输入完后按“回车”也行,点击“转换”也行。就会自己出来下面的这个窗体:这个窗体不能动,只能看,关闭按键就是两个richTextBox之间的那个条条,是不是感觉太小了,不方便?没关系,直接按下Esc键同样可以关闭!下面是源代码: 首先是第一个窗体的源代码: 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;using System.Collections;namespace _09._11{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        Dictionary<char, char> c = new Dictionary<char, char>();        private void Form1_Load(object sender, EventArgs e)        {            //StreamReader a=new StreamReader(“”);            string[] b = File.ReadAllLines(@”C:UsersacerDesktopST.txt”);            for (int i = 0; i < b.Length; i++)            {                c.Add(b[i][0], b[i][2]);            }        }        StringBuilder sc = new StringBuilder();        private void button1_Click(object sender, EventArgs e)        {            sc.Clear();            string a=richTextBox1.Text;            char[] b = a.ToCharArray();            foreach (var i in b)            {                if (c.ContainsKey(i))                    sc.Append(c[i]);                else                    sc.Append(i);            }            Form2 u = new Form2();            u.a = richTextBox1.Text;            u.b = sc.ToString();            u.ShowDialog();        }    }}然后是第二个窗体的源代码:  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.Collections;namespace _09._11{    public partial class Form2 : Form    {        public Form2()        {            InitializeComponent();        }        public string a, b;        Dictionary<int, char> array = new Dictionary<int, char>();        private void richTextBox2_TextChanged(object sender, EventArgs e)        {        }        private void Form2_Load(object sender, EventArgs e)        {            richTextBox1.Text = a;            //richTextBox2.Text = b;            char[] o=b.ToCharArray();            for (int j = 0; j < o.Length; j++)            {                array.Add(j, o[j]);            }        }        private void button1_Click(object sender, EventArgs e)        {            this.Close();        }        int i = 0;        private void timer1_Tick(object sender, EventArgs e)        {            if (i < array.Count&&array.Count>0)            {                richTextBox2.Text += array[i];                i++;            }        }    }}注意:第二个窗体为了一个小小的效果,用了一个timer微信小程序

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 简体字转换繁体字的winfrom小程序
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏