【发布时间】:2019-05-21 06:45:53
【问题描述】:
我正在创建一个WPF 应用程序,并且我有一个包含"X" 的button。默认情况下,字体大小为 12,文本居中,但是一旦我增加字体大小,对齐就会下降。我无法理解。
以 12 号字体居中文本:
字体大小为 24 的偏离中心文本
我的代码:
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Content="-" Foreground="White" Margin="756,8,8,0" Height="30" VerticalAlignment="Top" VerticalContentAlignment="Center" BorderThickness="0" Background="{x:Null}" FontWeight="Bold"/>
<Button Content="X" Foreground="White" Margin="6,8,8,0" Height="30" VerticalAlignment="Top" VerticalContentAlignment="Center" BorderThickness="0" Background="{x:Null}" FontWeight="Bold"/>
</StackPanel>
【问题讨论】: