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
|
@ -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.ComponentModel;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
@ -15,6 +17,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private bool _scaled;
|
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()
|
public BmpView()
|
||||||
{
|
{
|
||||||
if (DesignMode)
|
if (DesignMode)
|
||||||
|
|
|
@ -5,6 +5,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public class SNESGraphicsViewer : RetainedViewportPanel
|
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()
|
public SNESGraphicsViewer()
|
||||||
{
|
{
|
||||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||||
|
|
Loading…
Reference in New Issue