If you use MYOB on a laptop, and at work have multiple screens but at home just have the laptop screen, MYOB will re-open on the screen that is no longer attached to your computer.
You then need to click click, move, use you keyboard to move the window back into view.
This is an easy fix:
public void loadLastState() {
// variables
bool bLocationVisible = false;
// behave differently if the window was full screen or not last time
if (Properties.Settings.Default.windowIsFullScreen) {
// the window was full screen when it was last closed, just do that
this.WindowState = FormWindowState.Maximized;
} else {
// get the last location
System.Drawing.Point ptLocation = Properties.Settings.Default.windowLocation;
// if it hasn't been set, both X and Y values will be 0, exit
if (ptLocation.X == 0 && ptLocation.Y == 0) { return; }
// Check the point is still on one of our screens
foreach (Screen s in Screen.AllScreens) {
if (s.Bounds.Contains(ptLocation)) { bLocationVisible = true; }
}
// If the point is one on of our screens, proceed with setting location and size
if (bLocationVisible) {
this.StartPosition = FormStartPosition.Manual;
this.Location = ptLocation;
this.Size = Properties.Settings.Default.windowSize;
}
}
}