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变成圆角

 

wpf button变成圆角

上一篇:C#取绝对值函数


下一篇:API的理解