Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am experiencing difficulty in displaying a symbol "►" in a control:

I cannot get the arrow to display correctly when the string is printed to the screen.

I have tried:

legendWindow1.Add(count.ToString() + "\u25C4");


and

legendWindow1.Add(count.ToString() +  "►"\);


both of which just produce a square apposed to the symbol. I have followed the string through the add method and it is entering that incorrectly so its something in this line that i cant work out.

Thanks in advance George
Posted

Set control's font to any unicode font available, like "Arial Unicode MS"
 
Share this answer
 
Comments
grwithey 14-Sep-11 9:39am    
I tried this and still could not get the arrows to show, although i did use an arrow from areal font.
BobJanova 14-Sep-11 10:10am    
It should do. Make sure you set the font on the control you're trying to put this symbol into, and the font you're choosing contains the character.

I suspect that it is entering Add fine but your IDE is using a font which can't display it so you get a square in the debugger.
"16" Solid Forward Arrow. "16" is the exented ascii code for the symbol that you want. You can use it
C#
Convert.ToChar(16)
This will give you that symbol. But of course your page must be support extended ascii format

http://www.susanminor.org/forums/showthread.php?734-Extended-ASCII-Display-Characters[^]
 
Share this answer
 
v2
Comments
grwithey 14-Sep-11 9:42am    
I could not access the link due to work filtering and had a go but think i must have missed something as couldn't get this working.

I found a solution but its not ideal

<pre> protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);

Graphics g = e.Graphics;
GraphicsPath gp = new GraphicsPath();

// Font for the form is set to areal
gp.AddString("►", Font.FontFamily, (int)Font.Style, (int)(Font.SizeInPoints * 1.33333333), new Rectangle( 10,10,100,100), StringFormat.GenericTypographic);
g.FillPath(Brushes.Red, gp);
}</pre>

Overriding the paint of a normal form and drawing the string from a graphics path will work, but there probably is an easier way
hilmisu 14-Sep-11 9:47am    
the best solution is working solution =)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900