mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Fix for #1257
CreateGraphics was the function being disposed in the using, the form handle was still floating around. Suggestion to optimize the dpi function
This commit is contained in:
@@ -11,12 +11,16 @@ namespace mRemoteNG.UI.GraphicsUtilities
|
||||
// Dpi of a 'normal' definition screen
|
||||
private const int BaselineDpi = 96;
|
||||
|
||||
|
||||
public SizeF GetResolutionScalingFactor()
|
||||
{
|
||||
using (var g = new Form().CreateGraphics())
|
||||
{
|
||||
return new SizeF(g.DpiX / BaselineDpi, g.DpiY / BaselineDpi);
|
||||
}
|
||||
//This method could be optimized, as it is called for every control / subcontrol
|
||||
//and causes overhead for 100s in the options page
|
||||
using (var f = new Form())
|
||||
{
|
||||
var g = f.CreateGraphics();
|
||||
return new SizeF(g.DpiX / BaselineDpi, g.DpiY / BaselineDpi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user