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

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

问题描述

我在winform应用程序中使用了richtextbox。
当我粘贴ជំ្ាាួួួួួួួួួួួួួgood good good good good:::::::::::::ng ng ng ng ng ng ng ng ng ng ng ng ng ng ng ng ng alt =在这里输入图像描述>



但是当我粘贴'مرحب阿拉伯语文本时出现一些问题:在第一个插入有编码问题: / p>



我没有在richtextbox中找到任何Enсoding属性。如何解决编码问题?

解决方案

使用RichTextBox v5。 Visual Studio中的默认值为v4。它解决了这个问题。

  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;
}
返回婴儿车;
}
}
}


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:

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

解决方案

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天全站免登陆