Example #1
0
        private void RescaleForDpi()
        {
            var test = Shcore.ProcessDpiAwareness;

            if (test == CommonWin32.HighDPI.PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE)
            {
                var child = VisualTreeHelper.GetChild(ContentWindow, 0) as FrameworkElement;
                if (child != null)
                {
                    DpiEvents.ScaleElement(child, _dpiScaleFactor, true);
                }
            }

            var dpiArgs = new DpiChangeEventArgs(ContentWindow, _monitorDPI, _dpiScaleFactor);

            ContentWindow.RaiseEvent(dpiArgs);
            DpiEvents.SetWindowDpi(ContentWindow, dpiArgs.NewDpi);
            DpiEvents.SetWindowDpiScale(ContentWindow, dpiArgs.Scale);
        }
Example #2
0
 private void theWindow_DpiChange(object sender, DpiChangeEventArgs e)
 {
     Debug.WriteLine("Window got DPI change to " + e.NewDpi);
 }
Example #3
0
        private void RescaleForDpi()
        {
            var test = Shcore.ProcessDpiAwareness;
            if (test == CommonWin32.HighDPI.PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE)
            {
                var child = VisualTreeHelper.GetChild(ContentWindow, 0) as FrameworkElement;
                if (child != null)
                {
                    DpiEvents.ScaleElement(child, _dpiScaleFactor, true);
                }
            }

            var dpiArgs = new DpiChangeEventArgs(ContentWindow, _monitorDPI, _dpiScaleFactor);
            ContentWindow.RaiseEvent(dpiArgs);
            DpiEvents.SetWindowDpi(ContentWindow, dpiArgs.NewDpi);
            DpiEvents.SetWindowDpiScale(ContentWindow, dpiArgs.Scale);
        }
Example #4
0
 private void theWindow_DpiChange(object sender, DpiChangeEventArgs e)
 {
     Debug.WriteLine("Window got DPI change to " + e.NewDpi);
 }