mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 23:19:13 +08:00
Clamps window size and position (#25267)
Adds a floor value for size (320x240) and position (0x0)
This commit is contained in:
parent
ddbe5e3908
commit
518f8d6dda
@ -62,7 +62,12 @@ namespace RegistryPreview
|
||||
SizeInt32 size;
|
||||
size.Width = (int)jsonSettings.GetNamedNumber("appWindow.Size.Width");
|
||||
size.Height = (int)jsonSettings.GetNamedNumber("appWindow.Size.Height");
|
||||
appWindow.Resize(size);
|
||||
|
||||
// check to make sure the size values are reasonable before attempting to restore the last saved size
|
||||
if (size.Width >= 320 && size.Height >= 240)
|
||||
{
|
||||
appWindow.Resize(size);
|
||||
}
|
||||
}
|
||||
|
||||
// reposition the window
|
||||
@ -71,7 +76,12 @@ namespace RegistryPreview
|
||||
PointInt32 point;
|
||||
point.X = (int)jsonSettings.GetNamedNumber("appWindow.Position.X");
|
||||
point.Y = (int)jsonSettings.GetNamedNumber("appWindow.Position.Y");
|
||||
appWindow.Move(point);
|
||||
|
||||
// check to make sure the move values are reasonable before attempting to restore the last saved location
|
||||
if (point.X >= 0 && point.Y >= 0)
|
||||
{
|
||||
appWindow.Move(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user