diff --git a/src/LogExpert/Config/ConfigManager.cs b/src/LogExpert/Config/ConfigManager.cs index 95b6eecf..bc68df0f 100644 --- a/src/LogExpert/Config/ConfigManager.cs +++ b/src/LogExpert/Config/ConfigManager.cs @@ -281,6 +281,8 @@ private Settings LoadOrCreateNew(FileSystemInfo fileInfo) settings.preferences.maximumFilterEntries = 30; } + SetBoundsWithinVirtualScreen(settings); + ConvertSettings(settings); return settings; @@ -444,6 +446,17 @@ private static List ReplaceOrKeepExisting(ExportImportFlags flags, List return newList; } + // Checking if the appBounds values are outside the current virtual screen. + // If so, the appBounds values are set to 0. + private void SetBoundsWithinVirtualScreen(Settings settings) + { + var vs = SystemInformation.VirtualScreen; + if (vs.X + vs.Width < settings.appBounds.X + settings.appBounds.Width || + vs.Y + vs.Height < settings.appBounds.Y + settings.appBounds.Height) + { + settings.appBounds = new Rectangle(); + } + } #endregion protected void OnConfigChanged(SettingsFlags flags)