In .NET, GDI+ functionality resides in the System.Drawing.dll. Before you start using GDI+ classes, you must add reference to the System.Drawing.dll and import System.Drawing namespace. In this sample, I use class GraphicsPath, which is defined in the System.Drawing.Drawing2D namespace.
Creating this project is simple. Create a Windows application and add reference to the System.Drawing.dll using Project->Add Reference menu item. See Figure 1.
Figure 1. Adding reference to System.Drawing.dll
After that add these two lines.
using
System.Drawing;using System.Drawing.Drawing2D;
Note: If you create a Windows application using VS.NET, you only need write only one line.
using System.Drawing.Drawing2D;
After that add a Form_Paint event handler using the Properties Window. See Figure 2.

Figure 2. Adding Form_Paint event handler.
And write the following code on the Form_Paint event handler.


fazal rehmanPosted Oct 13, 2007, 2:16 AM
i want to drow shapes with mouse in my application
Lakshmi Kanth BeditedPosted Sep 12, 2007, 7:15 PMEdited Sep 12, 2007, 7:16 PM
Hi, I have developed an GDI interface to show lines and polygons. I want to show screentips for lines/polygons when user hovers mouse on the line/polygon. Can you give me an idea how to implement this functionality with .net graphics. Thanks, Kanth.
Goran MiticPosted Jul 8, 2007, 5:07 AM
Hello, I an fairly new to C#, and I have a question. User can input the dimensions of rectangle, and rectangle is drawn on tab page, but if input is too big, it goes off tab page. How can I resize? Thank you, Goran
Xuyen Nguyen KimPosted May 7, 2007, 2:09 PM
hi !! i want draw a hexagon on form c#.net but i don't know it,so i hope evrybody help me !!!please guide to me step by step and the most detail !!!!hurry up please !!!because i need urgent !!!!!thanks so much !!!!!!!!!!!!!!
a zPosted Apr 1, 2007, 6:15 PM
I done it by console application, it was so nice. But I did it using eventhandler of buttons, when I press the button it gives this draw.