Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any formula for resize font when resizing form?
Message
From
08/12/2009 15:16:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
08/12/2009 11:09:12
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01438061
Message ID:
01438108
Views:
134
>I couldn't express myself. I want to know which fontsize I have to select when I resize my form. Sample:
>
>my form's size is 300x400 my font is 9
>
>I resized my form to 400x500 and my font should be ???

Make it proportional. Looking at the first number, your form got resized by a factor of (400/300), about 1.33, so you multiply the font size by this number - 9 x 1.33.

However, there is also the second number, which is less: 500/400 = 1.25.

I guess you should use the smaller of these two values (use the min() function).

In this case, the calculation for the font size is: 9 x min(400/300, 500/400)

>I resized my form to 500x700 and my font should be ???

Repeating the above calculation: 9 x min(500/300, 700/400)

Probably some rounding is needed, too.

To apply this formula, you would need to store the original size and width.

The generic formula might look something like this:

This.FontSize = round(This.OriginalFontSize x min(ThisForm.Width / ThisForm.nOriginalWidth, ThisForm.Height / ThisForm.nOriginalHeight)), 0)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform