Objects resize to window?

One question: It seems to now work fine under Windows 8 and 10, but Windows 7 is still borked a little. Do I need to specify the design size of the window in Init, even if the max and starting window size is specifically set in the Inspector? I am specifying the font size of each label in the code as you pointed out.

You can see an example of this below:

Windows 8.1 (with 125% fonts and RubberViews):
Windows 8.1
Looks good, text labels fit fine. Nice!

Windows 7 (125% fonts and Rubberviews):
Windows 7
Top two labels (Load a Finish Line Universe, etc) are too large for the space still, being cut off.

Since Windows 8, scaling is homogeneously applied to everything.

In Windows 7, you must set the fonts design size in each label before calling Init. Was it the case ?

I recommend to always set the window design size in Init, because you never know the resolution of the machine your software will execute on. To give you an example, let us say you have a design size of 1024 x 769. One would think you should always be safe, since there are no machine today with less resolution.

Unfortunately, a 1024 x 768 machine with scaling 150% on Win 8-10 will have an effective resolution of 682 x 512. At launch, Windows will display your window at that maximum resolution (it cannot have Windows larger than the screen), this will result in grossly oversized controls, since without the design size, Init will believe this is how you designed it.

[quote=245771:@Michel Bujardet]Since Windows 8, scaling is homogeneously applied to everything.

In Windows 7, you must set the fonts design size in each label before calling Init. Was it the case ?[/quote]

I put the line: Me.TextSize = X (where I do substitute the proper size in X, such as Me.TextSize = 17, Me.TextSize = 14, or whatever the size is) in the Open event of each label on the Window and it is specified on the Inspector part of the window for each label too. Should I be doing it differently?

The Windows example shown had a laptop resolution of 1366x768, and the app itself is 1366x768. Could this be an issue if I don’t specify the window size in the Init?

That should work fine under Windows 7. But it should not be used in Windows 8-10.

At 125% scaling under Win 8 - 10, the laptop effective resolution will be 1092 x 614. If you don’t specify the design size in Init, your controls will be too big.

That’s my point, Windows 7 doesn’t seem to work, shown in the screenshot link above. Even with the labels text size being specified. What could i be doing wrong?

Let us try something else.

  • Place a canvas on your window (anywhere is fine, even off the visible area), let us call it cvsFontSize
  • Make it a square with faces half the design textsize of your font. For instance size 16, width = 8, height = 8
  • After SizAll, do lblNetworkingYet.TextSize = cvsFontSize.Width+cvsFontSize.Height

As the canvas will already be resized proportional to the window like other elements, your font will be sized alike.

How does this approach differ exactly? What is this code doing? Just curious.

Normally, in systems where fonts are not artificially inflated such as Windows 7, Init takes a picture of the window with all its controls and fonts sizes. Then when the size of the window changes, SizAll makes controls proportional to the new window size. Font size is based on an average between width and height, since fonts do not have width and height, just size.

Since the normal font size engine is thrown off by Windows 7 font scaling, we use the control scaling instead.