Reputation:
There is a special character which can be seen here http://www.fileformat.info/info/unicode/char/1f4a9/index.htm
I have the correct font for it, i can even copy/paste it in firefox. I can see the text in firefox without using an image. But when i paste it into winforms i do not. I see two boxes with ?
inside of each. Its one letter. Oddly enough i can copy the text out and paste it into firefox and see it correctly. (Note i made sure to copy/paste regular text in firefox to ensure i am not repasting what i originally copied).
I'm setting the font like so textBox3.Font = new Font("symbola", 12);
symbola has the font required to view that special character. In fact before i downloaded it and right click install on the ttf file firefox didnt show the character correctly. I have restarted my computer since.
How do i get winform to display the character properly?
Upvotes: 1
Views: 1339
Reputation: 21878
It works for me:
private void Form1_Load(object sender, EventArgs e)
{
button1.Font = new Font("symbola", 16);
button1.Text = "\U0001F4A9";
}
2 remarks:
FWIW, my test was done using VS2008 and .NET 3.5 under Win7 x64
EDIT: I also tested it under VS2010 / .NET 4 and .NET 3.5: Works like a charm
Upvotes: 4
Reputation: 11214
You may try using a RichTextBox
. I have had intermittent trouble using Unicode on the regular TextBox
, even with all fonts installed correctly. It nearly always works when you set it from code, but there are sometimes problems with interactivity. At any rate, I never know the cause of it, but RichTextBox
has typically worked in these situations.
Upvotes: 1