WPF 按钮圆角


WPF 按钮圆角_第1张图片


<Button Cursor="Hand" Name="button1" Opacity="1" Grid.Column="3" Grid.Row="1" Click="button1_Click" Grid.ColumnSpan="3" Grid.RowSpan="2" Foreground="#FF7C7C03">
            <Button.Template>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="33,33,33,33" Name="PART_Background">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                <GradientStop Color="White" Offset="0.0" />
                                <GradientStop Color="Silver" Offset="0.5" />
                                <GradientStop Color="White" Offset="0.0" />
                            </LinearGradientBrush>
                        </Border.Background>
                        <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                </ControlTemplate>
            </Button.Template>
        </Button>


CornerRadius中的值即是设置圆角的值。


原文地址:http://luacloud.com/2011/wpf-roundedbutton.html


你可能感兴趣的:(c,button,border,WPF)