如何根据WPF应用程序中的屏幕大小调整主窗口的大小

本文关键字:何根 调整 窗口 屏幕 应用程序 WPF | 更新日期: 2023-09-27 18:21:27

所以,这是我的代码:

<Window x:Name="LauncherWindow" x:Class="PlayProjectBilly.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:PlayProjectBilly"
    mc:Ignorable="d"
   Title="Project Billy" Height= "460" BorderThickness="0" Visibility="Visible" WindowStartupLocation="CenterScreen" Icon="Game-Icon.ico" Width="640">

我真的很想知道如何根据用户的屏幕大小以百分比调整主窗口的大小,谢谢:)

如何根据WPF应用程序中的屏幕大小调整主窗口的大小

将高度和宽度绑定到SystemParameters.PrimaryScreenHeight&系统参数。主要屏幕宽度。https://msdn.microsoft.com/en-us/library/system.windows.systemparameters.primaryscreenheight%28v=vs.110%29.aspx