【发布时间】:2019-06-01 01:10:10
【问题描述】:
我有一个 WPF TextBlock,我试图将它的左上角和右上角变成圆形,所以我将它包围在边框内:
<Border CornerRadius="10 10 0 0"
BorderThickness="2"
BorderBrush="DarkBlue"
Margin="10 15 10 0">
<TextBlock Text="This is a TextBlock with rounded top left and top right corners"
Background="Yellow"
Foreground="Black"
TextAlignment="Center" />
</Border>
这种方法的问题是当边框背景颜色与TextBlock背景颜色不同时,它不起作用。显示如下(见左上角和右上角):
仅当我将 TextBlock 背景颜色设置为透明时才有效,但我需要将其设置为不同于透明的颜色。
【问题讨论】:
标签: wpf visual-studio-2008 .net-3.5 textblock cornerradius