在 RichTextBox 中显示特殊字符(韩文字母)

发布于 2024-09-17 10:13:53 字数 663 浏览 0 评论 0原文

我的问题可能有点令人困惑,但我认为仍然值得关注。

基本上,我正在设计一个程序来在 RichTextBox 中显示所有可打印的 Unicode 字符。

我使用的是 VC# 2010 Express 版。

然而,RichTextBox有一个严重的问题:一些特殊字符无法正确显示。

例如,某些韩文字符(ᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑᄒ)可以在Microsoft Word中正确显示。我复制到RichTextBox后,字符无法正确显示。但是,当我复制回Microsoft Word时,它可以正确显示。

因此,这是一个显示问题(字符本身是正确的)。我猜这可能是字体问题。

一些相关房产信息: RichTextBox.Font.GdiChaSet RichTextBox.Font

如何解决?这样所有可打印的Unicode字符都可以正确显示(不同的CharSet使用不同的字体是可以接受的)。

实际上,我需要有关粘贴时删除所有格式的进一步帮助 rtbxFileContent.Paste(DataFormats.GetFormat(DataFormats.Text)); // DataFormats.UnicodeText

我仍然需要正确显示所有可打印字符,但没有任何格式(字体除外)。

谢谢。

希望我能让自己被理解。

My question might be a little bit confusing, but I think it's still worth of paying some attention.

Basically I'm designing a program to display all printable Unicode characters in a RichTextBox.

I'm using VC# 2010 Express Edition.

However, the RichTextBox has a critical problem: some special characters cannot be displayed correctly.

For example, some Korean Characters (ᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑᄒ), can be displayed correctly in Microsoft Word. After I copy to the RichTextBox, the characters cannot be displayed correctly. However, when I copy back to Microsoft Word, it can be displayed correctly.

Therefore, it's a display problem (the characters themselves are correct). I guess it might be a font problem.

Some related property info:
RichTextBox.Font.GdiChaSet
RichTextBox.Font

How can I solve it? So that all printable Unicode characters can be displayed correctly (using different fonts for different CharSets are acceptable).

Actually, I need further assistance about removing all formatting when pasting
rtbxFileContent.Paste(DataFormats.GetFormat(DataFormats.Text)); // DataFormats.UnicodeText

I still need to have all printable characters to be displayed correctly, but without any formatting (except font).

Thanks.

Hope I made myself understood.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紅太極 2024-09-24 10:13:53

我讨厌听起来像 MS Office Clippy,但你的问题看起来很像 这个

本质上,你不是生气,而是很难。您可以尝试使用 UTF8EncodingBinaryWriter/BinaryReader

I hate sounding like MS Office Clippy, but your questions seems a lot like this one.

Essentially, you're not mad, it is hard. You could try reading/writing the text manually, using UTF8Encoding and BinaryWriter/BinaryReader.

始终不够 2024-09-24 10:13:53

我发现字体“Arial Unicode MS”几乎可以解决我的问题,但是字符集中的一些字符对我来说看起来很奇怪。 (另外,如果用户计算机没有安装字体“Arial Unicode MS”怎么办?

所以我仍在寻找更好的通用解决方案来解决我的问题:针对 RichTextBox 中的不同字符集自动使用不同的字体。

谢谢。

I found the font "Arial Unicode MS" can almost solve my problem, but some characters from Char Sets looks weird to me. (Also, what if the user computer has not installed the font "Arial Unicode MS"?

So I'm still looking for a better universal solution to my question: automatically using different font for different Char Sets in the RichTextBox.

Thanks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文