public void WindowBorder_Load(object sender, EventArgs e) { this.DoubleBuffered = true; this._parentWindow.TextChanged += (o, a) => { Setup(); Desktop.ResetPanelButtons(); }; this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2; this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2; if (!this.IsDialog) { Engine.AppearanceManager.OpenForms.Add(this); } SaveSystem.GameReady += () => { if (Shiftorium.UpgradeInstalled("wm_free_placement")) { AppearanceManager.Invoke(new Action(() => { this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2; this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2; })); } AppearanceManager.Invoke(new Action(() => { Setup(); })); }; ControlManager.SetupControls(this); Setup(); var sWin = (IShiftOSWindow)ParentWindow; sWin.OnLoad(); }
private static void StartCoherence(Process prc) { RECT rct = new RECT(); while (!GetWindowRect(prc.MainWindowHandle, ref rct)) { } AppearanceManager.Invoke(new Action(() => { IShiftOSWindow coherenceWindow = new Applications.CoherenceOverlay(prc.MainWindowHandle, rct); AppearanceManager.SetupWindow(coherenceWindow); SetWindowPos(prc.MainWindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); //MakeExternalWindowBorderless(prc.MainWindowHandle); })); }
/// <summary> /// Initializes a new instance of the <see cref="ShiftOS.WinForms.WindowBorder"/> class. /// </summary> /// <param name="win">Window.</param> public WindowBorder(UserControl win) { InitializeComponent(); IsFocused = true; this.Activated += (o, a) => { IsFocused = true; SetupSkin(); }; this.Deactivate += (o, a) => { IsFocused = false; SetupSkin(); }; this._parentWindow = win; Shiftorium.Installed += () => { try { this.ParentForm.Invoke(new Action(() => { Setup(); })); } catch { } }; SkinEngine.SkinLoaded += () => { try { Setup(); (ParentWindow as IShiftOSWindow).OnSkinLoad(); ControlManager.SetupControls(this.pnlcontents); } catch { } }; this.Width = (LoadedSkin.LeftBorderWidth * 2) + _parentWindow.Width + LoadedSkin.RightBorderWidth; this.Height = (LoadedSkin.TitlebarHeight * 2) + _parentWindow.Height + LoadedSkin.BottomBorderWidth; this.pnlcontents.Controls.Add(this._parentWindow); this._parentWindow.Dock = DockStyle.Fill; this._parentWindow.Show(); SetupControls(this); ControlManager.SetupControls(this._parentWindow); Shiftorium.Installed += () => { Setup(); ParentWindow.OnUpgrade(); }; Setup(); this._parentWindow.TextChanged += (o, a) => { Setup(); Desktop.ResetPanelButtons(); }; if (!this.IsDialog) { Engine.AppearanceManager.OpenForms.Add(this); } SaveSystem.GameReady += () => { if (Shiftorium.UpgradeInstalled("wm_free_placement")) { AppearanceManager.Invoke(new Action(() => { this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2; this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2; })); } AppearanceManager.Invoke(new Action(() => { Setup(); })); }; }