So with the advent of DX and some recent user feedback from a user of one of our apps who actually use non-standard Windows Font size settings, I've been again looking into Delphi font scaling and high(er) DPI displays of late, and as a consequence ran across the following SO post: http://goo.gl/N9079t

So with the advent of DX and some recent user feedback from a user of one of our apps who actually use non-standard Windows Font size settings, I've been again looking into Delphi font scaling and high(er) DPI displays of late, and as a consequence ran across the following SO post: http://goo.gl/N9079t

In one of the answers there's an interesting discussion by Ian Boyd where he provides most but not all of the code for (mostly) properly scaling forms and controls based on a user's desktop font and font-size preferences.  

As I was curious to test his code I therefore collected all the code into a unit and implemented the missing bits.  Having been quite impressed with just how well it seems to work, I've now put it up on pastebin in case anyone else might find it useful:
http://pastebin.com/dKpfnXLc

Hope it's of use to someone. :)  (Yes, I know, only 3 years or so late to the party!) 
http://goo.gl/N9079t

Comments

  1. Coincidentally, just yesterday I got a bug report for one of my plugins with 125% scaling on XE2.  (No idea if that's even an officially supported configuration for XE2...)  This will be very useful - thankyou!

    ReplyDelete
  2. Note I modified the comment block in the code very slightly so as to not lead anyone potentially down the garden path in future.  Ian for some reason suggested standardizing on Segoe UI 14pt and I repeated this advice into the original comment block.  However having had a look at what 14pt would look like as default, I've concluded that this is likely too large as a general default, unless you have a really high res screen to develop on.  Consequently I've removed the "14pt" advice and added a comment to additionally note that Segoe UI has been the default system font since Windows Vista.

    ReplyDelete
  3. How's the latest versions of Delphi treating font scaling? Have you upgraded Delphi version?

    ReplyDelete

Post a Comment