VFPX - GDIPlusX v1.10

Library and Source Code release

This ZIP file contains the GDIPlusX library (as an APP) and the full source code.

For the associated samples and documentation, as well as a list of issues addressed in this build, please visit the official release page in the VFPX section of CodePlex.

About the library

This library was intended to provide Visual FoxPro 9.0 developers with an object based library to wrap the 600+ functions included with the GDI+ API. The intent is to mimic the System.Drawing namespace in the .NET Framework. All classes in the library are based on the classes included in the System.Drawing namespace and other classes that are dependencies for classes in the System.Drawing namespace. Some additional additional functionality has been added to take advantage of features built in to VFP 9.0

For more information about the goals and additional references to the library, please visit the GDIPlusX home page.

Distribution files

System.APP This is a standalone APP which contains all the source files for the GDIPlusX library. This compiled version includes debug info and some _Membderdata attributes to assist with intellisense. If you distribute this file with your application, you only need to compile the GDIPlusX.vcx library into your application
System_Lean.APP This is the same as above, but the debug info and intellisense functionality have been turned off. If you are concerned about your distribution size, this APP is for you. It is about 250KB smaller than the standard System.app and usually ZIPs up to about 140KB. Make sure you rename it to "System.APP" if you distribute this file instead of the standard System.app.
GDIPlusX.vcx This visal class library contains the imgCanvas class and will need to be compiled into your application for distribution, if you utilize this class.

How to use the library

To initialize the library execute the following command:

DO system.app

This will add a property to the _SCREEN system variable called SYSTEM. This SYSTEM object contains a property called DRAWING. This DRAWING object (referenced as _SCREEN.System.Drawing) can be thought of as an object factory and is designed to mimic the System.Drawing namespace in the .NET Framework.

The following sample fills a circle using a Blue brush and draws a rectangle using a Red pen, on the VFP desktop:

DO system.app
WITH _SCREEN.System.Drawing
* Create a Graphics object
gfx = .Graphics.FromHWnd(_SCREEN.HWnd)

* Fill an ellipse using a Blue brush
gfx.FillEllipse(.Brushes.Blue,30,30,400,200) * Create a Red pen
myPen = .Pen.New(.Color.Red,2)
* Draw a rectangle using the pen
gfx.DrawRectangle(myPen,20,20,400,200) ENDWITH

If you will be doing any drawing to a VFP Form, we reccommend that you use the imgCanvas class. The class is based on the VFP Image class and allows your to draw directly to an Image object. There are several benefits to this, one of the most important is that by utilizing this class you do not have to write any code to handle Paint events to the VFP Form. You just draw to this Image object and VFP will handle this tedious task for you.

This class is located in the "source" folder and is part of the GDIPlusX.vcx class library. Just add this class to your Form and use the BeforeDraw method to call your drawing commands.

Here is the same sample above, but utilizing the imgCanvas class's BeforeDraw method. Note that the oGfx property represents the Graphics object for the imgCanvas class:

FUNCTION BeforeDraw
WITH _SCREEN.System.Drawing

* Fill an ellipse using a Blue brush
This.oGfx.FillEllipse(.Brushes.Blue,30,30,400,200) * Create a Red pen
myPen = .Pen.New(.Color.Red,2)
* Draw a rectangle using the pen
This.oGfx.DrawRectangle(myPen,20,20,400,200) ENDWITH

For more information, please download the samples and documentation from the official release page.

Support

If you have any questions of comments about the library or you would like to report an issue, please use the discussion forums at the VFPX site. The GDIPlusX team members as well as other GDIPlusX library users frequent the forums and should be able to assist you. If you would like to contact the project manager privately, send an email to gdiplusx@moxiedata.com.