private void frmUnarchive_Load(object sender, EventArgs e) { bool flag = false; StartPosition = FormStartPosition.Manual; Screen[] allScreens = Screen.AllScreens; Screen[] array = allScreens; for (int i = 0; i < array.Length; i++) { Screen screen = array[i]; Rectangle rect = new Rectangle(10, 10, Width, Height); if (screen.WorkingArea.Contains(rect)) { flag = true; } } if (ini.IniReadValue("UNARCHIVE", "LOCATIONY") == "" || ini.IniReadValue("UNARCHIVE", "LOCATIONX") == "" || !flag) { Top = 100; Left = 100; if (!flag) { MessageBox.Show("The Unarchive target was positioned outside the viewable area of the screen, and will been repositioned to the default location.", "Unarchived target retrieved", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); log.Logger(1, "Target location reset"); } } else { Top = Convert.ToInt32(ini.IniReadValue("UNARCHIVE", "LOCATIONY")); Left = Convert.ToInt32(ini.IniReadValue("UNARCHIVE", "LOCATIONX")); } log.Logger(0, "Target initialized at X: " + ini.IniReadValue("UNARCHIVE", "LOCATIONX") + "; Y: " + ini.IniReadValue("UNARCHIVE", "LOCATIONY")); }