mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
added func for calculating scaled width
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user