Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
PLS I NEED SOME HELP WITH THE DRAWING ON C#

1. What Application? (Console, Win Forms or anything else)
2. How to write a line between 2 points?
3. How to write a circle?
4. How to do a 3D thing like cube or sphere?

I need this! Pls some help!

I am asking much! Sry!

:)
Posted
Comments
Richard C Bishop 7-May-13 13:54pm    
Help yourself and do some research. Each point you listed can be answered by the internet and has been millions of times.

Console applications are not suited for such tasks.
You may easily satisfy points 2 and 3 using Windows Forms (see, for instance "Drawing with Graphics in WinForms using C#"[^]).
For point 4 (3D shapes) you may consider using XNA (see, for instance, "Drawing 3D Primitives using Lists or Strips"[^]).
 
Share this answer
 
You can't use a console app - they are text based, and drawing lines means putting stars in the right place - tedious and rarely effective (google for "ASCII Art" and you'll find some exceptions).

So Winforms, WPF, or XNA.
The simplest is Winforms:
Add a panel to a form, and handle it's Paint Event.
In the handler, add the following:
C#
Graphics g = e.Graphics;
You can then use the graphics context to draw directly on the panel surface:
C#
Point p1 = new Point(10, 10);
Point p2 = new Point(100, 200);
g.DrawLine(Pens.Red, p1, p2);
g.DrawEllipse(Pens.Green, new Rectangle(p1, new Size(75, 75)));
Will draw a Red line, and a Green circle.

Drawing 3D objects is generally a lot more work, and I would suggest that you get a good grounding in 2D first, before you think of moving to 3D.
 
Share this answer
 

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