Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

VFP IMAGING



Rotate texts in your reports for old VFP versions.

This post is for people that still did not upgrade to VFP9.

As Ken Murphy said in one of his latest posts in Foxite forum: "... the capabilities of the VFP 9 report generator alone are worth the price of the upgrade. Everything else is a bonus."

 

 

When I worked with VFP7  I created a function that uses GPIMAGE2 GDI+ class, that you can download from this link. http://cchalom.sites.uol.com.br/GPIMAGE/index.htm

Have a look at the file "Teste.frx" that is in the "Examples" folder of the class. Below is a screenshot with the possible results using the report designer

 

How to use:

After downloading the file, run TESTE.FRX, it uses a simple class I've created called GDIPSTRING, It's very easy to use. If you open GDIPSTRING.PRG, you'll see on the initial notes the parameters used.

 

Basically, you'll need to:

  • add an image object
  • dimenson the image to the desired size of the string you need
  • double click the image object, select "From File"

  • call the function GDIPSTRING, as shown:

(gdipstring( ; lcDimensionType, ; lnWidth, ; lnHeight, ; lcString, ; lcFontName, ; lnFontSize, ; lcFontStyle, ; lcTextAlignment, ; lnRotation))

Parameters:

tcDimensionType = character, "P" ou "I" - dimensions in pixels or inches 
tnWidth     = numeric, Width 
tnHeight    = numeric, Height 
tcString    = character, Text string
tcFontName  = character, Font Name
tnFontSize  = numeric, Font Size 
tcFontStyle = character, Font Style
           B - bold     I - italic     U - underline     S -  
tcTextAlignment = character, Alignment
           C - center     L - left     R - right 
tnRotation  = numeric, Direction 
           0 - normal (not recomended) 
           1 - Vertical - Rotate 90º
           2 - Horizontal - Rotate 180º (upside down) 
           3 - Vertical - Totate 270º

For example, if you put in FROM FILE : (gdipstring("P",190,31,"Foxbrasil","Arial",20,"UB","C",2)) You'll have : String "Foxbrasil", arial, size 20, underline bold, centered, upside down drawn inside the virtual rectangle of size 190,31 in pixels.

 

VERY IMPORTANT:

Don't forget to put the expression between parenthesis () !!

After running the report, you need to delete manually the temporary files used to create the gradients, with just one line of code:

DELETE FILE (ADDBS(GETENV("TEMP")) + "tmp*.jpg")

 

 

Neither GpImage2 nor GdipString are not under development anymore. I'm just sharing it, bacause maybe some people that still did not upgrade to VFP9 need some GDI+ usage. Today, when I reopened the source code for GdipString, I found many things that can be enhanced. If you have interest in improving it, feel free to do so, and please send your updates so that other may benefit too.

 

ABOUT GPIMAGE2:

The class GPIMAGE2 brings a wrapper class to gdiplus.dll that allows to use most of the GDI+ functions. Visit the link below, download the source, and run the samples available in the "EXAMPLES" folder. There you'll find a simple class that permits to create some interesting charts, drawings, reports with vertical labels, etc.

http://cchalom.sites.uol.com.br/GPIMAGE/index.htm

If you're not using Windows XP or VFP8, you'll need to download the distributable version. There's a good explanation on GPIMAGE's website.

Here you'll find some other samples, at the "FAQS" page.

http://cchalom.sites.uol.com.br/GPIMAGE/faqs.htm

 

More info about GPIMAGE:

GDI+ for all VFP versions

New version of GPIMAGE2

Published Wednesday, October 31, 2007 1:00 PM by cesarchalom
Filed Under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

What do you think?

(required) 
(optional)
(required)