.
GDI+ FAQ
Skip Navigation Links

Using GDI+ in your .NET programs

To use GDI+ in your .NET based programs you need to do a couple of things before you start on the business of writing the code. First, you need to include a reference to the System.Drawing assembly and secondly, you need to declare that you are using the System.Drawing namespace in your code.

Adding a reference to the System.Drawing DLL in Visual Studio is easy. Just right click on the references section in the Solution Explorer and select "Add Reference". The following dialog will be shown.

Figure 1. The Add Reference dialog.

At the top of each code file you should declare which namespaces the code in the file uses. This is done with the using statement as shown in the listing below

 

using System;

using System.Drawing;

//other using statements go here

namespace MyNamespace

{

  //classes go here...

}

If you use the command line compilers with the .NET SDK the C# compiler automatically adds the references for you.

If you use the Visual Studio IDE and create a Windows Forms application then the code wizard will automatically include the correct statements for you and you'll be able to use GDI+ right away.

Return to the Beginners Guide index.

Sponsored By
DaraizeTechnologies.com

&
Proteus Groupe

Bob Powell

Create your badge

Copyright © Bob Powell 2000-2012.  All rights reserved.