[Just pour parle . Note that here now is 3:40 AM ! So, I'm sleeping ].
I almost abandoned the idea of using only the Designer and its scripts.
So, I was developing a small project with the intention of use code later to scale the layout.
Just out of curiosity, I wanted to look at the effect of Designer' AutoScaleAll only, on two different devices.
I had not ever done!
Let's see if I can explain the facts.
I have created a Variant which has the size and the density of my smartphone. Then: (Landscape - Full Screen without Title): 800 x 480 - 1.5.
I have a Button; Height = 50 (dips in the Designer)
a) What should be its (new, scaled) height in a device (tablet) with: 1280 x 800 - 1 ?
I think: if the Variant scale was 1, as the tablet, the Height should be: (800 / 480) x 50 = 83.
Considering the different density: (1 / 1.5) x 83 = 55.
Well, it is scaled to... 49!
Given that the result was not convincing, I have set the layout to 800 x 480 - 1, then I have changed only the Scale of the Variant.
b) What should be the scaled height now?
Height should be: (800 / 480) x 50 = 83.
It is scaled to... 62!
Finally, both 100%y and GetDeviceLayoutValues.Height returns 752, despite the full screen and no title, instead of 800.
Maybe I would need to know how it works internally.
Thanks anyway for the answer (exactly what I thought I got, unfortunately).
P.S. In the example, I had only need to get the height of a simple button double in the case where the device had double height compared to variant height (same densities).
The Designer should do this very easily.
It works properly with any scale. There is no advantage for using non-normalized scales and it makes it more difficult to understand. The possibility is still there mainly for historic reasons.
So, I set AutoScaleRate to 1; "Value of 1 is similar to specifying all values with percentage".
Button1.Height should be = 800(device h) / 480(variant h) * 50 = 83.333
(but, wow, it is almost right, 81 )
Perhaps the problem is that "similar".
If you go the "The screen does not have half pixels" way, you must then do some rounding...
800/480 = 1.66666667 which should be rounded to 1.67 BUT the designer works with only one decimal place for the density so we get 1.6
1.6 x 50 = 80 ... closer now, hugh!?
If you go the "The screen does not have half pixels" way, you must then do some rounding...
800/480 = 1.66666667 which should be rounded to 1.67 BUT the designer works with only one decimal place for the density so we get 1.6
1.6 x 50 = 80 ... closer now, hugh!?