added func for calculating scaled width

This commit is contained in:
David Sparer
2018-09-03 09:06:27 -05:00
parent 3c5baae568
commit ccf364f2dd

View File

@@ -1,4 +1,5 @@
using System.Drawing;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace mRemoteNG.UI
@@ -10,6 +11,15 @@ namespace mRemoteNG.UI
public SizeF ResolutionScalingFactor { get; } = GetResolutionScalingFactor();
/// <summary>
/// Scale the given nominal width value by the <see cref="ResolutionScalingFactor"/>
/// </summary>
/// <param name="width"></param>
public int CalculateScaledWidth(int width)
{
return (int) Math.Round(width * ResolutionScalingFactor.Width);
}
private static SizeF GetResolutionScalingFactor()
{
using (var g = new Form().CreateGraphics())