Beispiel #1
0
 private void UpdateDPIText()
 {
     DPI.Text = "Window Information" +
                "\n\tSystem DPI = " + PerMonitorDPIHelper.GetSystemDPI() +
                "\n\tWPF Rendering DPI = " + this.WpfDPI +
                "\n\tMonitor DPI = " + this.CurrentDPI +
                "\n\tWindow Size in Physical Pixels  = " + (this.ActualWidth * this.WpfDPI / 96.0) + " x " + (this.ActualHeight * this.WpfDPI / 96.0);
 }
        private void UpdateDPIText()
        {
            var           hMonitor    = PerMonitorDPIHelper.GetMonitorFromWindow(this);
            MonitorInfoEx monitorInfo = new MonitorInfoEx();

            monitorInfo.Init();
            GetMonitorInfo(hMonitor, ref monitorInfo);
            var monitorRect = monitorInfo.Monitor;

            DPI.Text = "Window Information" +
                       "\n\tSystem DPI = " + PerMonitorDPIHelper.GetSystemDPI() +
                       "\n\tWPF Rendering DPI = " + this.WpfDPI +
                       "\n\tMonitor DPI = " + this.CurrentDPI +
                       string.Format("\n\tMonitor Dimensions = X:{0} Y:{1} Width:{2} Height: {3}", monitorRect.Left, monitorRect.Top, monitorRect.Right - monitorRect.Left, monitorRect.Bottom - monitorRect.Top) +
                       "\n\tWindow Size in Physical Pixels  = " + (this.ActualWidth * this.WpfDPI / 96.0) + " x " + (this.ActualHeight * this.WpfDPI / 96.0);
        }