Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating widths and heights of strings
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01072336
Message ID:
01072528
Views:
23
Bob,

Just to be clear are you talking about a DO FORM form or a REPORT FORM form?

The units in the frx are 10,000ths of an inch. If I put that text onto a report label with your font the statusbar shows the width of the text to be 1.23 inches which corresponds to the 12291.667 you are seeing. Since that font is proportional and a fair number of the letters are under the average width it explains why your calculation is bigger than VFP's internal calculation of the width.

>I'm creating a form programatically and want to calculate the correct values for width and height. Up to now I've been approximating with:
>
>replace width with 70*(fontsize*(LEN(expr)) )
>
>As an example, I have a label with a value of "Length of time in this position", Font:Arial Narrow - 8 point - I make the width to be 18480, but if I open the form in Designer it gets changed to 12291.667
>
>The value of FONTMETRIC(7,'Arial Narrow',8) is 13 pixels, the length of the string is 31.
>
>How do I use these values to get 12291.667?
>
>The other thing is that the height that I create for the label string is too small, and on the screen it appears to truncate descending characters, yet when I print the form it's ok.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform