public void UpdateWindowSettings() { // Is it the worker thread? if (this.InvokeRequired) { StringArgReturningVoidDelegate d = new StringArgReturningVoidDelegate(UpdateWindowSettings); // Request the UI thread. this.Invoke(d); } else { //Is it the UI thread? // Change the window name. this.Text = rsTools.GetGameTitle(); Rectangle rect = rsTools.GetScreenSize(); // Adjust the client area. (for removing the scrollbar) this.ClientSize = new Size(rect.Width, rect.Height); browser.ClientSize = new Size(rect.Width, rect.Height); // Set the window position in the display. this.CenterToScreen(); // The focus can get only in an UI thread, not worker thread (it's very strict.) rsTools.Focus(); // Check the platform. EvaluateScript(browser, @"Utils.isCef = function() { return true; };"); } }