I'm writing a C# app (XNA to be specific) and I'm having some very strange behavior when trying to set the window location. The first time I set the location, it places it in a weird place (always the same) but if I set it again, even on the next line, it works.
This is the code I'm using. The initial values in Location are 657, 286. After attempting to set it to 1920, 300, the position becomes 2257, 314. If I run the set again, it correctly updates the position to 1920, 300.
I've tried a full clean and rebuild and tried running in both Debug and Release. I've also tried putting some code before this line just to attempt to rule out a timing issue. I'm totally stumped here, so any help would be greatly appreciated.
var form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle( this.Window.Handle );
form.Location = new System.Drawing.Point( 1920, 300 );