Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryMovingToScreen()

void Terraria.Graphics.WindowStateController.TryMovingToScreen ( string screenDeviceName)
inline

Definition at line 23 of file WindowStateController.cs.

24 {
25 if (CanMoveWindowAcrossScreens && TryGetBounds(screenDeviceName, out var bounds) && IsVisibleOnAnyScreen(bounds))
26 {
27 Form form = (Form)Control.FromHandle(Main.instance.Window.Handle);
28 if (WouldViewFitInScreen(form.Bounds, bounds))
29 {
30 form.Location = new Point(bounds.Width / 2 - form.Width / 2 + bounds.X, bounds.Height / 2 - form.Height / 2 + bounds.Y);
31 }
32 }
33 }
bool TryGetBounds(string screenDeviceName, out Rectangle bounds)
bool WouldViewFitInScreen(Rectangle view, Rectangle screen)

References Terraria.Graphics.WindowStateController.CanMoveWindowAcrossScreens, System.Drawing.Control, Terraria.Main.instance, Terraria.Graphics.WindowStateController.IsVisibleOnAnyScreen(), Terraria.Graphics.WindowStateController.TryGetBounds(), and Terraria.Graphics.WindowStateController.WouldViewFitInScreen().