private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == (int)PInvoke.User32.WindowMessage.WM_DPICHANGED) { var dpiX = CoreExtensions.GetHiWord(wParam); var dpiY = CoreExtensions.GetLoWord(wParam); this.ChangeDpi(new Dpi(dpiX, dpiY)); handled = true; } return(IntPtr.Zero); }