Files
wpf-notifyicon/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/Interop/SystemInfo.cs
Philipp Sumi 337da82ce2 Release 1.0.6
*************

CHG   Removed version text from NuGet files.
CHG   Replaced Tuple usage from SystemInfo by Point, which is also supported by .NET 3.5.
CHG   Changelog and credits update.
2016-03-21 09:53:34 +01:00

39 lines
905 B
C#

using System.Windows.Interop;
namespace Hardcodet.Wpf.TaskbarNotification.Interop
{
public static class SystemInfo
{
private static System.Windows.Point? dpiFactors;
private static System.Windows.Point? DpiFactors
{
get
{
if (dpiFactors == null)
using (var source = new HwndSource(new HwndSourceParameters()))
dpiFactors = new System.Windows.Point(source.CompositionTarget.TransformToDevice.M11, source.CompositionTarget.TransformToDevice.M22);
return dpiFactors;
}
}
public static double DpiXFactor
{
get
{
var factors = DpiFactors;
return factors.HasValue ? factors.Value.X : 1;
}
}
public static double DpiYFactor
{
get
{
var factors = DpiFactors;
return factors.HasValue ? factors.Value.Y : 1;
}
}
}
}