wpf button变成圆角
Posted aijiao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wpf button变成圆角相关的知识,希望对你有一定的参考价值。
<Button Grid.Column="5 " Width="80" Height="40" Content="搜索" HorizontalAlignment="Center" VerticalAlignment="Center"> <Button.Template> <ControlTemplate TargetType="x:Type Button"> <Border BorderBrush="TemplateBinding Control.BorderBrush" BorderThickness="0" CornerRadius="33,33,33,33"> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Offset="0.0" Color="White" /> <GradientStop Offset="0.5" Color="Silver" /> <GradientStop Offset="0.0" Color="White" /> </LinearGradientBrush> </Border.Background> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="TemplateBinding ContentControl.Content" /> </Border> </ControlTemplate> </Button.Template> </Button>
结果如下
以上是关于wpf button变成圆角的主要内容,如果未能解决你的问题,请参考以下文章
Swift开发教程--设置圆角Button和圆角边框TextView