Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
2.00/5 (5 votes)
See more:
Hi,

How can I Draw a shape (Circle) in a Console window.

C#
Console.Write("Something"); //To write something

Console.???; //To Draw a circle
Posted
Comments
BobJanova 14-Feb-12 10:27am    
Console.Write("O");

;)
Sergey Alexandrovich Kryukov 14-Feb-12 11:01am    
Best answer so far... :-)
--SA
Fardan 14-Feb-12 11:02am    
Not a good place for joking
fjdiewornncalwe 14-Feb-12 11:07am    
+5 +5 +5 if I could. Thanks for the chuckle.
manognya kota 14-Feb-12 11:47am    
ha ha:) good one though.

That is really not that easy: Console applications are not Graphics oriented - they are character based, and your outputs are limited to the characters you can print to the screen - there are no DrawLine or DrawElipse functions.

If you really, really want to do this,. then your best best is to google for "ASCII art circle" and see what you get. But do remember that the console is limited in how many lines it can display at one time, so your vertical resolution is never going to be much good.

I would recommend that you use a WinForms application instead.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-Feb-12 11:00am    
Why WinForms? Or WPF... 5 anyway.
--SA
Fardan 14-Feb-12 11:02am    
Somebody downvoted my question. Do you know why?
OriginalGriff 14-Feb-12 11:57am    
Looking at the histogram, two people did. But no, I don't know who, or why.
Fardan 20-Feb-12 19:55pm    
Ok. Thanks for answer.
manognya kota 14-Feb-12 11:47am    
+5.
Others mentioned it - Console is not for drawing - But I was curiose what I could do: here is what I came up with.

C#
Console.WriteLine(@"    -     ");
Console.WriteLine(@"  /   \   ");
Console.WriteLine(@" |     |  ");
Console.WriteLine(@"  \   /   ");
Console.WriteLine(@"    -     ");


Sorry for kind of "fun" answer - but your question is for shure nothing mission critical.
 
Share this answer
 
Comments
NeptuneHACK! 14-Feb-12 14:49pm    
lol my 5

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