diff --git a/MainWindow.xaml b/MainWindow.xaml index 6f4a2e2..9660e85 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -13,7 +13,7 @@ Loaded="Window_Loaded" Title="SUNLIGHT SCCM b0.0.1 (2024/08/10)" Height="1080" Width="1920" Background="#FF003640" - WindowState ="Maximized" WindowStyle="None"> + WindowStyle="None" ResizeMode="NoResize"> diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index ffa937b..9a03eb3 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -14,6 +14,7 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; +using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; @@ -35,6 +36,7 @@ namespace SunlightCentralizedControlManagement_SCCM_ public MainWindow() { + WindowStartupLocation = WindowStartupLocation.CenterScreen; DataContext = new MainWindowViewModel(); InitializeComponent(); CountDown(); @@ -144,7 +146,6 @@ namespace SunlightCentralizedControlManagement_SCCM_ { Picture.Content = new View.DispenseView(); } - private void Buttonhelp_Click(object sender, RoutedEventArgs e) { WindowsView.Help help_page = new WindowsView.Help(); @@ -242,7 +243,15 @@ namespace SunlightCentralizedControlManagement_SCCM_ private void Window_Loaded(object sender, RoutedEventArgs e)//打开页面 { - + var windowHandle = new WindowInteropHelper(this).Handle; + var currentScreen = Screen.FromHandle(windowHandle); + + System.Drawing.Rectangle rectangle = currentScreen.WorkingArea; + + this.Left = rectangle.Left; + this.Top=rectangle.Top; + this.Width = rectangle.Width; + this.Height = rectangle.Height; } }