【发布时间】:2010-07-29 13:40:52
【问题描述】:
我更改了一个按钮的 ControrTemplate,用 CornerRadius 和 BevelBitmpaEffect 给它一个边框。看起来足够体面,只需付出最小的努力。把它放在彩色背景上,然后问题就显现出来了。
lightangle 来自的角落有一个带有直角角的白色剪断。可能来自灯光效果,但使用cornerRadius 时非常明显。我认为我对此无能为力(除了不使用cornerRadius 等显而易见的问题)?
编辑:
这段代码应该会为你产生同样的问题
<Style x:Key="TabButtons" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="8"
SnapsToDevicePixels="True"
Name="BtnBorder"
Width="80"
Height="35"
BorderThickness="1"
BorderBrush="DarkBlue">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="LightBlue" Offset="0" />
<GradientStop Color="DarkBlue" Offset="1" />
</LinearGradientBrush>
</Border.Background>
<Border.BitmapEffect>
<BevelBitmapEffect BevelWidth="5"
EdgeProfile="CurvedOut"
LightAngle="135"
Relief="0.1"
Smoothness="1" />
</Border.BitmapEffect>
<ContentPresenter Name="BtnContent" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
例如在浅蓝色背景上使用此按钮
<Border Background="LightBlue" >
<Button Style={StaticResource TabButtons} >Test</Button>
</Border>
【问题讨论】:
标签: wpf cornerradius bevelled