msnews.microsoft.com said:
Thanks for Replying Peter
Im in the Vs2008 Designer
TextBox Control with font set to lucinda Console
a PushButton
public Button1_Click(object sender,EventArgs e)
{
this.tx1.Text.Append(((char)216).ToString())
}
the above right now is all im doing...
Not that the above actually would compile, but…what is the output when
you run code like that? I would expect this character: Ø
Is that the character you wanted?
If you want the graphics characters, you need to use the correct Unicode
value for them. And frankly, you should just use the \u escape for
character literals rather than casting.
The character found at the value 216 in extended ASCII character
encodings is actually Unicode 0x2588. The other characters are in that
general range as well (you can use the Character Map program in Windows,
or similar references, to find exact Unicode values for specific
characters).
So if you want the "solid block" character, you need to use this instead:
public Button1_Click(object sender,EventArgs e)
{
this.tx1.Text.Append('\u2588');
}
If you want to work in an extended ASCII character encoding, then you
need to create your characters in a byte array and then use the Encoding
class to convert to Unicode from whatever extended ASCII encoding you've
chosen to work with (e.g. IBM437, ibm850, ISO-8859-1, etc.). That could
be worthwhile if you are receiving characters from some remote client,
such as what might happen in an actual terminal application. (Of
course, in that case you'll be forced to use whatever encoding is being
received from the remote client).
Otherwise, you should just use the correct Unicode values from the outset.
Pete