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.
开发者_Python百科Hope I made myself understood.
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
.
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.
精彩评论