示例#1
0
        void OnSourceInitialized(object sender, EventArgs e)
        {
            source = (HwndSource)PresentationSource.FromVisual(this);

            // calculate the DPI used by WPF; this is the same as the system DPI
            Matrix matrix = source.CompositionTarget.TransformToDevice;

            DpiInformation = new DpiInformation(96D * matrix.M11, 96D * matrix.M22);

            if (isPerMonitorDpiAware)
            {
                source.AddHook(WndProc);

                RefreshMonitorDpi();
            }
        }
示例#2
0
        private void OnSourceInitialized(object sender, EventArgs e)
        {
            this.source = (HwndSource)HwndSource.FromVisual(this);

            // calculate the DPI used by WPF; this is the same as the system DPI
            var matrix = source.CompositionTarget.TransformToDevice;

            this.dpiInfo = new DpiInformation(96D * matrix.M11, 96D * matrix.M22);

            if (this.isPerMonitorDpiAware)
            {
                this.source.AddHook(WndProc);

                RefreshMonitorDpi();
            }
        }