The EASY way to make a C# Windows.forms app really per monitor DPI aware

As posted in another post, many apps have problems with windows scaling.

See these screen-dumps from Windows lengthy guide that was found here

UPDATE 2020. After Windows creators update, they made things slightly more complicated, sorry…

Here is a reasonably minimalistic approach. You will often just need code like this:

    public partial class Form1 : Form {
         public Form1() {
             InitializeComponent();
             DPI_Per_Monitor.TryEnableDPIAware(this, SetUserFonts);
         }
         void SetUserFonts(float scaleFactorX, float scaleFactorY) {
            var OldFont = Font;
            Font = new Font(OldFont.FontFamily, 11f * scaleFactorX, OldFont.Style, GraphicsUnit.Pixel); 
            OldFont.Dispose();
         }
         protected override void DefWndProc(ref Message m) {
             DPI_Per_Monitor.Check_WM_DPICHANGED(SetUserFonts,m, this.Handle);
             base.DefWndProc(ref m);
         }
     }

You will need to obey a few rules, but often it can be implemented in existing code in minutes!

Continue reading “The EASY way to make a C# Windows.forms app really per monitor DPI aware”

Automower 435X AWD, Husqvarna, review.

This Automower 435X AWD is an upgrade from my 330X, See review here.

Overall: 9/10. Hardware: Fine. Software: Improved, still unpolished!

This is both a continuation of the previous Automowers and a fundamentally different approach

Updated 2020-04-29, Some stuff are fixed with newer firmware.

2020-08-05 This review has evolved over time from an early review, with several updates, so bare with me, that things are not in a straight chronological line…

2020-09-05 Updated with new stuck-bug

Continue reading “Automower 435X AWD, Husqvarna, review.”