예제 #1
0
        public static double ConvertSizeMonitorDpiToSystemDpi(Window window, double size)
        {
            Dpi systemDpi = GetSystemDpi();
            Dpi screenDpi = MonitorAwareProperty.GetAttachedProperty(window).WindowHandler.MonitorDpi;

            return(size * systemDpi.X / screenDpi.X);
        }
예제 #2
0
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            IsWindowPlacementReliable = true;             // This must be set before loading WindowPlacement.

            WindowPlacement.Load(_mainWindowViewModel.Settings.IndexString, this);

            var monitorProperty = MonitorAwareProperty.GetInstance(this);

            if (monitorProperty != null)
            {
                SetDestinationColorProfile(monitorProperty.WindowHandler.ColorProfilePath);
                monitorProperty.WindowHandler.ColorProfileChanged += (_, e) => SetDestinationColorProfile(e.NewPath);
            }
        }