General GDI Plus issues:

CoderSource.net
General GDI Plus issues:
Rating:

Date: 5/1/2004 12:00:00 AM

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_path\GDIPlus\includes 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_path\GDiPlus\lib\GdiPlus.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_path\GDIPlus\GdiPlus.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.

You Can Rate this Article, if you are Logged In      
 

More Links from CoderSource.net:

 
Refer to a Friend:

Your Details:

Name:     e-mail:

Friend Details:

Name:    e-mail:    


MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Add to Google
Add to My Yahoo!
Welcome to Codersource.Net Login | Register | Faq  

SEARCH
Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us