.net 简体转换繁体实例,繁体转换简体 Encode.dll下载

在项目中先引用Encode.dll  下面是下载地址:

Encode.dll

 

1、html页面代码

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="简繁转换.aspx.cs" Inherits="ASP.NET_语言基础.简繁转换" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtjian" TextMode="MultiLine" Width="500px" Height="200px" runat="server"></asp:TextBox><br />
        <asp:Button ID="btnjtof" runat="server" Text="简体转繁体" onclick="btnjtof_Click" />
        <asp:Button ID="btnftoj" runat="server" Text="繁体转简体" onclick="btnftoj_Click" />
        <br />
         <asp:TextBox ID="txtfan" TextMode="MultiLine" Width="500px" Height="200px" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

 


 

2、后台.cs代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EncodeMy;

namespace ASP.NET_语言基础
{
    public partial class 简繁转换 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnjtof_Click(object sender, EventArgs e)
        {
            EncodeRobert er = new EncodeRobert();
            txtfan.Text = er.SCTCConvert(ConvertType.Simplified, ConvertType.Traditional, txtjian.Text);
        }

        protected void btnftoj_Click(object sender, EventArgs e)
        {
            EncodeRobert er = new EncodeRobert();
            txtfan.Text = er.SCTCConvert(ConvertType.Traditional, ConvertType.Simplified, txtjian.Text);
        }
    }
}

 

3、效果图

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。