General GDI Plus issues

GDI Plus Description:

GDIPlus is a Microsoft object-oriented C++ library, which provides better access to the graphic devise interface of windows. 2D drawing and using pictures is improved a lot compared to the standard windows GDI. With GDIPlus you can draw custom objects, open various pictures and save them in different formats, use various fonts and text drawing routines and various palette functions.

GDI Plus Compatibility:

GDIPlus is developed originally for MS Visual Studio 7 but because the release of this product was postponed, versions of the library was released by Microsoft for Visual Studio 6. If you use Visual Studio 6, you should download the MFC GDI Plus library from here.
a) To use the library with Visual Studio 7 or later just include <gdiplus.h> in you project

b) To use the library with earlier versions of MSVS after downloading the library you must put it in a folder. Then add the directory your_pathGDIPlusincludes to you includes path in the development environment. Then you must include <gdiplus.h> in your project but before that you must define ULONG_PTR ? a definition used in GDPlus, but not defined in older versions of Visual Studio. So, suppose you want to include the library file in the file StdAfx.h from your project. You must add these lines:

#define ULONG_PTR ULONG
#include <gdiplus.h>

Then include the file your_pathGDiPluslibGdiPlus.lib to your project (simply use “Add file to project”) so it would be linked with the application.

After compiling the project copy the file your_pathGDIPlusGdiPlus.dll to the folder where your executable is (“Debug” or “Release” maybe).

Using the GDI Plus library:

To use any GDIPlus routines you must initialize the library first. The initialization is a function call with two parameters, which must be variables that exist throughout the GDPlus session. After you finish using GDIPlus you must call a function that closes the session.

A nice way of doing this, if you use MFC, is to add the variables in your CWinApp derived class (CYourProjectApp) like this:

private:
GdiplusStartupInput m_gdiplusStartupInput;
ULONG_PTR m_pGdiToken;
Then in the beginning of the InitInstance function of the app add the following line:
GdiplusStartup(&m_pGdiToken,&m_gdiplusStartupInput,NULL); //gdi+ init
Then override the ExitInstance function (if you haven?t) and add the following line:
GdiplusShutdown(m_pGdiToken); //gdi+ end session

After this operations you should be able to use the library’s functionality throughout your application.