自媒体干货网

您现在的位置是:首页 > 软件分享 > 正文

软件分享

微信翻译通讯软件

鹏城一哥2021-04-05软件分享1177
稍微修改了修改。大部分都能正常翻译了。使用的WPF代码如下。using System;using System.Collections.Generic;using 



稍微修改了修改。大部分都能正常翻译了。

使用的WPF
代码如下。
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPFtest
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void TB_normal_TextChanged(object sender, TextChangedEventArgs e)
        {
            TB_unicode_16.Text = CharacterToCoding(TB_normal.Text);
        }

        public string CharacterToCoding(string character)
        {
            string coding = "";

            for (int i = 0; i < character.Length; i++)
            {
                byte[] bytes = System.Text.Encoding.Unicode.GetBytes(character.Substring(i, 1));

                //取出二进制编码内容  
                string lowCode = System.Convert.ToString(bytes[0], 16);

                //取出低字节编码内容(两位16进制)  
                if (lowCode.Length == 1)
                {
                    lowCode = "0" + lowCode;
                }

                string hightCode = System.Convert.ToString(bytes[1], 16);

                //取出高字节编码内容(两位16进制)  
                if (hightCode.Length == 1)
                {
                    hightCode = "0" + hightCode;
                }

                coding += "\\u"  +(hightCode.ToUpper() + lowCode.ToUpper());

            }

            return  coding + "\\u3002";
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TB_unicode_16.SelectAll();
            TB_unicode_16.Copy();
        }
    }
}

https://conghua.lanzous.com/ia4WInokc5e

发表评论

评论列表

  • 这篇文章还没有收到评论,赶紧来抢沙发吧~