Subject Re: Metric conversion
From Tom <IHaveNoEmail@ddress>
Date Sat, 25 Mar 2023 16:16:35 -0400
Newsgroups dbase.getting-started

On 3/25/23 3:34 PM, Mervyn Bick wrote:
> On 2023/03/25 18:27, Tom wrote:
>> Hi all,
>>
>> Found lots of conversion formulas in the dUFLP but not the one I am
>> looking for.
>>
>> I wish to convert form metric characters to form metric pixels.
>>
>> Seems like I saw this in some program in the dUFLP but, as usual,
>> cannot remember where.
>>
>> Thanks in advance,
>>
>> Tom
>
> Set up a form with metric = 0 (Characters) with top = 10 , left = 10,
> height = 10 and width = 100 and save it. Open the form in the designer
> and change the metric to 6 (Pixels) and save.  If you open the form in
> the sourcecode editor you will see that
>
>        height = 10.0
>        left = 10.0
>        top = 10.0
>        width = 100.0
>
> has been changed to
>
>        height = 220.0
>        left = 70.0
>        top = 220.0
>        width = 700.0
>
>
> The easiest way to convert a form's metric from character to pixels is
> to open it in the designer, change the metric property from 0 to 6 and
> save the form. dBASE will do all the conversions for you.
>
> If you have many forms to convert you could write a program to read a
> form's source code line by line, parse each line and multiply height and
> top properties by 22 and multiply left and width properties by 7 before
> writing the line back to a new file.
>
> You will also need to check that the metric property is included in the
> form's constructor code.  It it is change it to 6, if it isn't (which is
> quite likely if you haven't changed the metric property and then changed
> it back to character) then add the line.
>
>
> Mervyn.
>
>
>
>
*
Too late Mervyn. That is exactly how I went about figuring out what I
wanted. I did spend a bit of time scratching my head about why the
startup window with metric of characters with a height of 16 and a width
of 40 could possibly be taller than it was wide when ,to my eye, the
opposite was true. I made the assumption that both dimensions would have
the same conversion factor. My error.

If anyone might have use for it ...

multiply a character metric object's width by 7 to get pixel width

multiply a character metric object's height by 22 to get pixel height

Thanks for your response.

Regards,
Tom