现在的位置: 首页 > 综合 > 正文

中文繁体简体互换试验

2013年12月08日 ⁄ 综合 ⁄ 共 1128字 ⁄ 字号 评论关闭

繁体简体互换的例子

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;
        }

    }
}

界面如图:


转换后:

演示版下载: DEMO

抱歉!评论已关闭.