中文繁体简体互换试验
繁体简体互换的例子
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Threading;
using System.Globalization;
using Microsoft.VisualBasic; namespace UI_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/*繁体转简体*/
private void button1_Click(object sender, EventArgs e)
{
string s = txtContent.Text;
s = Strings.StrConv(s, VbStrConv.SimplifiedChinese, 0); // 繁体转简体
txtContent.Text = s;
}
/*简体转繁体*/
private void button2_Click(object sender, EventArgs e)
{
string s = txtContent.Text;
s = Strings.StrConv(s, VbStrConv.TraditionalChinese, 0); // 简体转繁体
//s = Strings.StrConv(s, VbStrConv.ProperCase, 0); // 首字母大写
//s = Strings.StrConv(s, VbStrConv.Narrow, 0); // 全角转半角
//s = Strings.StrConv(s, VbStrConv.Wide, 0); // 半角转全角
txtContent.Text = s;
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Threading;
using System.Globalization;
using Microsoft.VisualBasic; namespace UI_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/*繁体转简体*/
private void button1_Click(object sender, EventArgs e)
{
string s = txtContent.Text;
s = Strings.StrConv(s, VbStrConv.SimplifiedChinese, 0); // 繁体转简体
txtContent.Text = s;
}
/*简体转繁体*/
private void button2_Click(object sender, EventArgs e)
{
string s = txtContent.Text;
s = Strings.StrConv(s, VbStrConv.TraditionalChinese, 0); // 简体转繁体
//s = Strings.StrConv(s, VbStrConv.ProperCase, 0); // 首字母大写
//s = Strings.StrConv(s, VbStrConv.Narrow, 0); // 全角转半角
//s = Strings.StrConv(s, VbStrConv.Wide, 0); // 半角转全角
txtContent.Text = s;
}
}
}
界面如图:
转换后:
演示版下载: DEMO
版权声明:本文为tuyile006原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。