更改主窗口显示方式

This commit is contained in:
sc committed 2025-08-26 21:46:11 +08:00
commit 2659b01329
2 files changed
+12 -3

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@
Loaded="Window_Loaded" Loaded="Window_Loaded"
Title="SUNLIGHT SCCM b0.0.1 (2024/08/10)" Title="SUNLIGHT SCCM b0.0.1 (2024/08/10)"
Height="1080" Width="1920" Background="#FF003640" Height="1080" Width="1920" Background="#FF003640"
WindowState ="Maximized" WindowStyle="None"> WindowStyle="None" ResizeMode="NoResize">
<Window.Resources> <Window.Resources>
<Storyboard x:Key="MenuOpen"> <Storyboard x:Key="MenuOpen">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu">
+11 -2
View File
@@ -14,6 +14,7 @@ using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
@@ -35,6 +36,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
public MainWindow() public MainWindow()
{ {
WindowStartupLocation = WindowStartupLocation.CenterScreen;
DataContext = new MainWindowViewModel(); DataContext = new MainWindowViewModel();
InitializeComponent(); InitializeComponent();
CountDown(); CountDown();
@@ -144,7 +146,6 @@ namespace SunlightCentralizedControlManagement_SCCM_
{ {
Picture.Content = new View.DispenseView(); Picture.Content = new View.DispenseView();
} }
private void Buttonhelp_Click(object sender, RoutedEventArgs e) private void Buttonhelp_Click(object sender, RoutedEventArgs e)
{ {
WindowsView.Help help_page = new WindowsView.Help(); WindowsView.Help help_page = new WindowsView.Help();
@@ -242,7 +243,15 @@ namespace SunlightCentralizedControlManagement_SCCM_
private void Window_Loaded(object sender, RoutedEventArgs e)//打开页面 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;
} }
} }