Code:
@ y1,x1 to y2,x2 PATTERN ... PEN ...
This type of code in FPW 2.6 (and VFP9) will draw a rectangle on the screen within a given set of coordinates. If I execute this code on a converted FPW 2.6 screen in VFP9, it works properly (uses the correct coordinates). However, if I try to convert the @..PATTERN..PEN source code lines to shape or label objects, I am unable to replicate the upper-left coordinates and proper width and height in VFP9 when I manually convert the coordinates through the FONTMETRIC() functions. They are always a few pixels off, sometimes even 10 pixels.
I have modified the code to use any specified fonts, sizes and styles if present. The example code below does not include that logic because it adds unnecessary complexity to the example.
This code appears on a DEFINE CLASS method that is called after the object is added at the same location in the original source file where the @..PATTERN..PEN line exists, so it is using the same font references that would be used on that @.. line.
Example:
Code:
**********
* Load the font metric info
*****
lnFontHori = FONTMETRIC(6)
lnFontVert = FONTMETRIC(1)
**********
* It was observed that the covers don't align quite right in VFP9.
* The 1.005 and 1.064 were trial-and-error values determined to
* get them closer.
*****
this.Left = tfUlx * 1.005 * lnFontHori
this.Width = (tfLrx * 1.005 * lnFontHori) - this.Left
this.Top = tfUly * 1.064 * lnFontVert
this.Height = (tfLry * 1.064 * lnFontVert) - this.Top
Does anyone know what I'm doing wrong? If I take out the constant adjustments, it's even worse.
Best regards,
Rick C. Hodgin
317-879-6374