fix GB and SNES graphics viewers (and maybe others) due to incorrect (non-100%) windows DPI scaling setting
This commit is contained in:
parent
f078709b6b
commit
cfbc148975
src/BizHawk.Client.EmuHawk
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
//TODO - this is redundant with RetainedViewportPanel. Someone needs to reconcile the two.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing;
|
||||
|
@ -15,6 +17,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private bool _scaled;
|
||||
|
||||
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
|
||||
{
|
||||
int x = Location.X;
|
||||
int y = Location.Y;
|
||||
if (specified.HasFlag(BoundsSpecified.X))
|
||||
x = (int)(x * factor.Width);
|
||||
if (specified.HasFlag(BoundsSpecified.Y))
|
||||
y = (int)(y * factor.Height);
|
||||
var pt = new Point(x, y);
|
||||
if (pt != Location)
|
||||
Location = pt;
|
||||
}
|
||||
|
||||
public BmpView()
|
||||
{
|
||||
if (DesignMode)
|
||||
|
|
|
@ -5,6 +5,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public class SNESGraphicsViewer : RetainedViewportPanel
|
||||
{
|
||||
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
|
||||
{
|
||||
int x = Location.X;
|
||||
int y = Location.Y;
|
||||
if (specified.HasFlag(BoundsSpecified.X))
|
||||
x = (int)(x * factor.Width);
|
||||
if (specified.HasFlag(BoundsSpecified.Y))
|
||||
y = (int)(y * factor.Height);
|
||||
var pt = new Point(x, y);
|
||||
if (pt != Location)
|
||||
Location = pt;
|
||||
}
|
||||
|
||||
public SNESGraphicsViewer()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
|
Loading…
Reference in New Issue