I just want to draw simple 2D objects like circle, line, square etc in C#. How do I do that? Back in the Turbo C++ days I remember initializing some graphics library for doi
GDI+ using System.Drawing
You need to use GDI+.
How you do it depends slightly on what you want to draw on. You can draw on a control or a form, or you can draw on an image object. Either way, you need a System.Drawing.Graphics object which I believe is located in System.Drawing.dll.
You can instantiate a new Bitmap class and call Graphics.FromImage(myImage), and then draw using the methods on the Graphics object you just created. If you want to draw on a form or control just override the OnPaint method and look for the Graphics property on the EventArgs class.
More information on System.Drawing namespace here: http://msdn.microsoft.com/en-us/library/system.drawing.aspx
Here's a simple code sample that will get you started (assumes you have a PictureBox named pictureBox1):
Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawLine(new Pen(Color.Red), 0, 0, 10, 10);
}
pictureBox1.Image = bmp;
The graphics object has a bunch of other drawing methods, and Intellisense will show you how to call them.