3.51 increases Form size after compile

Started by Eddy Van Esch, January 25, 2012, 08:31:26 AM

Previous topic - Next topic

José Roca

There are other "funny" things that happen sometimes if you are using high DPI aware and non-DPI aware programs at the same time, but they happen randomly and I don't have pictures to post.

Eddy Van Esch

Jose,

Thanks a lot for your thorough explanations!
Reading this makes me want to go back to the old days ... In those days all we had to worry about was 'dll hell'. Nowadays we have 'dot NET hell', 'DPI hell'....  :o   ;)

Kind regards
Eddy
Eddy

Robert Eaton

Go back to using twips like in VB6  ;D
(twip = twentieth of a printers point or 1/72")

Elias Montoya


agreed. dll hell looks like heaven when compared to modern stuff.
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.

José Roca

But this time we are the guilty. People wanted more resolution for games, pictures, etc. More resolution means smaller pixels. You no longer can read the text comfortably and have to magnify it by scaling it or buying a very big monitor.

Beware of what you wish for. There is always a price to pay, and not only the price of the graphics driver.

Eddy Van Esch

Paul,

FF 3.10 did not show this behaviour. Would it be a bad idea to (temporarily?) roll back 3.51 to the 3.10 behaviour what this DPI handling is concerned?
Eddy

José Roca

#21
We are going nowhere until everything concerned with High DPI is understood and the correct code used. Taking an application that is not High DPI aware, running in virtualized mode, and trying to get it working in all the possible Windows modes is doomed to fail.

I have made an small example, using FF 3.5 running in virtualized mode. The designer looks fine, the form and control look fine, and when running the resulting executable, in virtualized mode, also looks fine. See attached pictures.


José Roca

#22
Great! I got it! Isn't it?

Far from the reality. Now, just changing to Windows 7 Basic theme, that disables virtualization, see how it looks.

José Roca

Unless FF will become a fully High DPI aware application and all the scaling is done consistently, there is nothing to do.

It doesn't matter if for that you use CWindow, pure SDK code or a mix of the two. Use pure SDK code if you feel more comfortable with it, and do all the scaling by mutiplying the pixels by factor ratios, or use twips as someone as suggested, or wathever, but do it consistently and test it with all the modes.

José Roca

#24
Now compare the two images below of CSED, that is fully High DPI aware. The first one running in Aero mode, and the second one in Windows 7 Basic mode.

Eddy Van Esch

Jose,

Do you mean that you solved this issue in CSED?
Eddy

José Roca

#26
Indeed. It works with all Vista/Windows 7 modes and any DPI value. I also know that works well with Windows XP, but I'm unable to test it with XP and large or custom fonts. You know, I only have Windows 7, a cheap computer and a cheap monitor. I no longer earn my life as a programmer and can't expend my money buying all kind of hardware and operating systems.

When working with High DPI aware applications, think on dots per inch (that is what DPI means) instead on absolute pixel values.

Properties like Width are not included for the sake of it, but to return the appropriate value for an scaled window or control, since the API function GetWindowRect returns absolute pixel values, not dots per inch.


   ' =====================================================================================
   ' Returns the width of the window
   ' =====================================================================================
   PROPERTY GET Width (OPTIONAL BYVAL bNoScale AS LONG) AS LONG
      LOCAL rc AS RECT
      GetWindowRect m_hwnd, rc
      IF bNoScale THEN
         PROPERTY = (rc.Right - rc.Left)
      ELSE
         ' // Divide by m_rx to make the result High DPI aware
         PROPERTY = (rc.Right - rc.Left) / m_rx
      END IF
   END PROPERTY
   ' =====================================================================================


Eddy Van Esch

Jose,

So if Paul uses your system in FF .... FF problem solved?   :)
Eddy

José Roca

Not so easy. It is not a matter of just adding #INCLUDE "CWndow.inc".

1) Learn ad understand all that it is involved and why is needed.

2) Make the designer High DPI aware, not an application that runs virtualized.

3) Think in dots per inch, not absolute pixel values.

This also applies to FF users, except writing the visual designer.

Jim Dunn

Jose, could you use a copy of Windows XP ???
3.14159265358979323846264338327950
"Ok, yes... I like pie... um, I meant, pi."