Console Applications

  • Thread starter Thread starter Paolo
  • Start date Start date
P

Paolo

Is there a way of accessing the various graphics characters to facilitate
drawing on the screen in console apps. I don't want to use the '-' (hyphen)
character - I thoughtthere were some 'graphics' characters hat were
available. I've looked at the Console Class specs and can't find anything
about this. Any advice would be appreciated.

Thanks
 
Is there a way of accessing the various graphics characters to facilitate
drawing on the screen in console apps. I don't want to use the '-' (hyphen)
character - I thoughtthere were some 'graphics' characters hat were
available. I've looked at the Console Class specs and can't find anything
about this. Any advice would be appreciated.

Have a look at unicode.org and see if you can find appropriate
characters there. In particular http://www.unicode.org/charts/symbols.html
might be helpful to you. However, I don't know offhand whether console
apps will be able to support those characters - and it may very well
depend on which font the user has specified for their console.

Jon
 
Hi Paolo,

You can use all the characters in a codepage. These include extended
characters like ╚ █ ▓ ┼ etc which you can make graphics with. Use an ascii
lookup table to find the character number for these characters and write them
by writing the character number while holding the ALT key [ALT] + [200] = ╚

PS! The character number between 128 and 255 may change in various codepages
so you may get a different character for the 200.

Sample program:

static void Main(string[] args)
{
Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.White;

Console.WriteLine("â•”â•â•â•â•â•â•â•â•â•â•â•â•â•â•—");
Console.Write("â•‘");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(" Hello World ");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("â•‘");
Console.WriteLine("╚â•â•â•â•â•â•â•â•â•â•â•â•â•â•");
Console.ResetColor();
Console.Read();
}
 
Morten: thank you. I thought there might be an extended character set (having
used similar techniques in COBOL). I was worried might have to get into the
Windows API!

Morten Wennevik said:
Hi Paolo,

You can use all the characters in a codepage. These include extended
characters like ╚ █ ▓ ┼ etc which you can make graphics with. Use an ascii
lookup table to find the character number for these characters and write them
by writing the character number while holding the ALT key [ALT] + [200] = ╚

PS! The character number between 128 and 255 may change in various codepages
so you may get a different character for the 200.

Sample program:

static void Main(string[] args)
{
Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.White;

Console.WriteLine("â•”â•â•â•â•â•â•â•â•â•â•â•â•â•â•—");
Console.Write("â•‘");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(" Hello World ");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("â•‘");
Console.WriteLine("╚â•â•â•â•â•â•â•â•â•â•â•â•â•â•");
Console.ResetColor();
Console.Read();
}

--
Happy Coding!
Morten Wennevik [C# MVP]


Paolo said:
Is there a way of accessing the various graphics characters to facilitate
drawing on the screen in console apps. I don't want to use the '-' (hyphen)
character - I thoughtthere were some 'graphics' characters hat were
available. I've looked at the Console Class specs and can't find anything
about this. Any advice would be appreciated.

Thanks
 
Back
Top