【发布时间】:2015-10-28 11:11:26
【问题描述】:
我正在开发一个需要独立于分辨率的数据库系统,一些使用仍在 1024 x 768 运行的屏幕,一些使用 1920 x 1080 的屏幕,而另一些则使用介于两者之间的所有屏幕。
我之前没有在 WPF 上做过很多工作,所以我只是开始尝试了解高度、宽度和对齐方式。
我目前拥有的是一个主窗口,其中包含一个网格,其中顶部有一行标签和一些导航按钮,以及登录人的时间和用户名。然后我在其下方有第二行,其中包含一个框架,我将页面加载到该框架中以用于程序的主导航。
在页面中我主要使用网格布局,偶尔也会使用堆栈面板。我遇到的最大问题之一就是这样的问题;
在低分辨率下这很常见,而在高分辨率下,按钮看起来不错;
这是其父网格中按钮的 XAML 代码;
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="HR" Margin="10" Click="RunHrSystem" FontSize="18.667" />
<Button Content="Companies" Margin="10" Click="RunCompSystem" FontSize="18.667" Grid.Row="1" />
<Button Content="People" Margin="10" Click="RunPeopleSystem" FontSize="18.667" Grid.Row="2" />
<Button Content="IT Management" Margin="10" Click="RunITManagementSystem" FontSize="18.667" Grid.Row="3"/>
<Button Content="Sales" Margin="10" FontSize="18.667" Grid.Row="4" />
<Button Content="Buying" Margin="10" FontSize="18.667" Grid.Row="5" />
<Button Content="Estimating" Margin="10" FontSize="18.667" Grid.Row="6"/>
<Button Content="Design" Margin="10" FontSize="18.667" Grid.Row="7"/>
</Grid>
是否有什么明显的我做错了,阻止按钮根据较低的分辨率调整大小?正如我所说,当我使用按钮时,我在整个程序中都会遇到这个问题,以及矩形形状,在某些情况下,标签的底部也会被切断。
【问题讨论】: