Browse Source

更改主窗口显示方式

master
sc 2 months ago
parent
commit
2659b01329
  1. 2
      MainWindow.xaml
  2. 13
      MainWindow.xaml.cs

2
MainWindow.xaml

@ -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">

13
MainWindow.xaml.cs

@ -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;
} }
} }

Loading…
Cancel
Save