diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 054573f..b16d409 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -2752,9 +2752,18 @@ namespace DS4Windows catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/Profile/formHeight"); Int32.TryParse(Item.InnerText, out formHeight); } catch { missingSetting = true; } - try { Item = m_Xdoc.SelectSingleNode("/Profile/formLocationX"); Int32.TryParse(Item.InnerText, out formLocationX); } + try { + int temp = 0; + Item = m_Xdoc.SelectSingleNode("/Profile/formLocationX"); Int32.TryParse(Item.InnerText, out temp); + formLocationX = Math.Max(temp, 0); + } catch { missingSetting = true; } - try { Item = m_Xdoc.SelectSingleNode("/Profile/formLocationY"); Int32.TryParse(Item.InnerText, out formLocationY); } + + try { + int temp = 0; + Item = m_Xdoc.SelectSingleNode("/Profile/formLocationY"); Int32.TryParse(Item.InnerText, out temp); + formLocationY = Math.Max(temp, 0); + } catch { missingSetting = true; } try { diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 0bea96e..1021bef 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -2179,8 +2179,8 @@ namespace DS4Windows FormHeight = oldsize.Height; } - FormLocationX = Location.X; - FormLocationY = Location.Y; + FormLocationX = Location.X > 0 ? Location.X : 0; + FormLocationY = Location.Y > 0 ? Location.Y : 0; if (!string.IsNullOrEmpty(appdatapath)) {