简体   繁体   English

在VB.NET中显示向下三角形▼(U + 25BC)

[英]Displaying a Downward Triangle in VB.NET ▼ (U+25BC)

Hey, I'm trying to figure out how to display the ▼ character properly in a .NET winform application. 嘿,我正在试图弄清楚如何在.NET winform应用程序中正确显示▼字符。

I am creating a custom control, and for the button, I want this character to appear. 我正在创建一个自定义控件,对于按钮,我想要显示这个角色。 I am able to set the text to this character, but it appears as a blank square. 我可以将文本设置为此字符,但它显示为空白方块。

Any ideas on what I need to do to make this character appear properly on my forms? 我需要做些什么才能让这个角色在我的表格上正确显示?

I am using Arial font, which is compatible with this symbol. 我使用的是Arial字体,它与此符号兼容。

EDIT : It is currently being set as follows: 编辑 :目前设置如下:

btnCalendarToggle.Text = "▼"  'Yes, it appears exactly like this in my code

More information on the character can be found here: http://www.fileformat.info/info/unicode/char/25bc/index.htm 有关角色的更多信息,请访问: http//www.fileformat.info/info/unicode/char/25bc/index.htm

EDIT2 : I tried adding some other Unicode characters, and got the following message: EDIT2 :我尝试添加一些其他Unicode字符,并得到以下消息:

"Some Unicode Characters in this file cannot be saved in the current codepage. Do you want to resave this file as Unicode in order to Maintain your data?" “此文件中的某些Unicode字符无法保存在当前代码页中。是否要将此文件重新保存为Unicode以便维护数据?”

After clicking YES on this message, it still didn't work. 在此消息上单击“是”后,它仍然无法正常工作。 It appears that the encoding method may be wrong for the file... I don't know what to set it to. 看来编码方法对于文件可能是错误的...我不知道该将它设置为什么。 Has anyone else tried to display this character in a winform before? 有没有其他人试图在winform中显示这个角色?

There can often be issues (both with source control systes and diff tools) if you embed more complex unicode characters in source files. 如果在源文件中嵌入更复杂的unicode字符,通常会出现问题(包括源控制系统和diff工具)。

It is often better to do it via an explicit escape sequence and keep the source file in a simpler encoding. 通过显式转义序列执行此操作通常更好,并使源文件保持更简单的编码。

btnCalendarToggle.Text = "\u25BC";

If this works it is likely that the problem is instead the encoding settings for the source file. 如果这样可行,则问题可能是源文件的编码设置。

Are you certain however that the font in question is Arial (try debugging and checking) since regardless of the above mentioned issues so long as the encoding is set to a legitimate Unicode one (and Visual Studio will convert the file for you if you embed such a character in it) this should have worked. 您是否确定有问题的字体是Arial(尝试调试和检查),因为无论上述问题如何,只要编码设置为合法的Unicode(并且Visual Studio将为您转换文件,如果您嵌入此类它应该有效。

Can you post the code you are currently using ? 你可以发布你目前使用的代码吗?

You can print out characters using the chr(int) function if you know the character code. 如果您知道字符代码,则可以使用chr(int)函数打印字符。

Dim i As Integer
For i = 0 To 255
    txtTest.Text = txtTest.Text & Chr(i) & " -- " & i.ToString() & Environment.NewLine
Next i

Try that and see if your character prints out. 试一试,看看你的角色是否打印出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM