编码打破RichTextBox中 [英] Breaks encoding in richtextbox

查看:221
本文介绍了编码打破RichTextBox中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的RichTextBox在我的WinForm应用程序。
当我粘贴ជំរាបសួរ高棉的文字都好:

I use richtextbox in my winform application. When I paste "ជំរាបសួរ Khmer" text all good:

在这里输入的形象描述

但是,当我粘贴'مرحب阿拉伯文字出现一些问题:在具有编码问题第一次插入:

But when I paste "'مرحب Arabic" text some problems appear: in the first insert having problems with the encoding:

我没有找到任何的RichTextBox性能Enсoding。我该如何解决编码的问题?

I have not found any Enсoding properties in richtextbox. How do I solve the problem of encoding?

推荐答案

使用RichTextBox的V5。在Visual Studio中默认为V4。 。RichTextBox的
{
函数[DllImport(KERNEL32:它修复等等这个问题。

Use RichTextBox v5. The default in Visual Studio is v4. It fixes this problem among others.

public class RichText50W : RichTextBox
{
    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    static extern IntPtr LoadLibrary(string lpFileName);
    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams prams = base.CreateParams;
            if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
            {
                prams.ClassName = "RICHEDIT50W";
            }
            return prams;
        }
    }
}

这篇关于编码打破RichTextBox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆