I have a string that I want to display a symbol in (the division symbol you learn in elementary, not a slash). According to the character map, the font that I'm using to display the string (inkpen2) has a division symbol code of 0xD4. I want a string to be "5 symbol 7" and display it to the user. Is it possible to do this?
string oneWay = "5 ÷ 7";
string anotherWay = "5 \u00F7 7";
Note that the first way can break if your source code ever has high bits stripped or is read by an app using some old text encodings. The second way is safer, just harder to read.
If you are using typographic math symbols, you may also want to use \u00D7 or × instead of *.
I don’t know where you get D4 from, but the Unicode value for the division symbol is F7, and C# uses unicode for all fonts.
The beast way to do this is to use the standard Unicode code point instead of a custom font. In your case, you want U+00f7
÷
.
You can put that character in a string within your source code the same way you would use any other character, and it should work on almost any computer.
If you want to use a custom font, you can use the WinForms RichTextBox Control to display text with multiple fonts. If your entire string is in the same font, you can use a regular Label control and set its Font
property. Note that you will need to distribute the font to your end-users, and that most fonts have license restrictions.