This tutorial will show you how to draw pie and font in ASP.NET 2.0 and C# by using the classes of Graphics.

The class of Graphics provide the method of drawing to display device. For instance, the Rectangle, point and others GDI+ basic components that can be assembled. The class of Pen is used for drawing line and curve, while the classes derived from the abstract class Brush can be used for fill the shape. The class of FontFamily have the similar design, but have a little bit of differences on modality.
First, you will need to import the System.Drawing, System.Drawing.Imaging, System.Drawing.Text namespace.

The namespace of system.Drawing provides the access to basic GDI+ graphic function. In the namespace of System.Drawing.Drawing2D, System.Drawing.Imaging and System.Drawing.Text , .Net provides more advanced functionalities.

Create canvas and fill the background

Draw the pie and fill

Draw font

Export and save to picture

End Drawing

Download Source Files