1234567891011121314151617181920212223242526272829303132333435 |
- using System.Windows.Interop;
- namespace Hardcodet.Wpf.TaskbarNotification.Interop
- {
-
-
-
- public static class SystemInfo
- {
- private static readonly System.Windows.Point DpiFactors;
- static SystemInfo()
- {
- using (var source = new HwndSource(new HwndSourceParameters()))
- {
- if (source.CompositionTarget?.TransformToDevice != null)
- {
- DpiFactors = new System.Windows.Point(source.CompositionTarget.TransformToDevice.M11, source.CompositionTarget.TransformToDevice.M22);
- return;
- }
- DpiFactors = new System.Windows.Point(1, 1);
- }
- }
-
-
-
- public static double DpiFactorX => DpiFactors.X;
-
-
-
- public static double DpiFactorY => DpiFactors.Y;
- }
- }
|