Example #1
0
 /// <summary>
 /// Handles DPI changed event.
 /// </summary>
 protected virtual void HandleDpiChanged(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
 {
     if (!OsVersion.Is10Redstone1OrNewer)
     {
         var dpi = DpiScaleExtension.FromIntPtr(wParam);
         VisualTreeHelper.SetRootDpi(_window, dpi);
         handled = true;
     }
 }
Example #2
0
 /// <summary>
 /// Processes windows message sent to NotifyIcon.
 /// </summary>
 /// <param name="m">Message</param>
 protected virtual void WndProc(ref Message m)
 {
     switch (m.Msg)
     {
     case WM_DPICHANGED:
         var oldDpi = _dpi;
         _dpi = DpiScaleExtension.FromIntPtr(m.WParam);
         if (!oldDpi.Equals(_dpi))
         {
             OnDpiChanged(oldDpi, _dpi);
         }
         m.Result = IntPtr.Zero;
         break;
     }
 }