简体   繁体   中英

How Can I Get This Border?

完成按钮中的边框很酷

How can i get that cool border in Done Button? Winforms/WPF doesn't matter.

I think i need gradient brush but I don't know how to use it like the above one.

EDIT: Now it looks so cool with this one (of course With Jim's help):

<Button x:Name="Button1" Height="40" Width="120" BorderThickness="2" Background="#FF262628" Foreground="White">
        <Button.BorderBrush>
            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" >
                <GradientStop Color="#AD9974" Offset="0" />
                <GradientStop Color="#533D25" Offset="1" />
                <GradientStop Color="#675A37" Offset="2"/>
                <GradientStop Color="#795B1F" Offset="3"/>

            </LinearGradientBrush>
        </Button.BorderBrush>
        DONE
    </Button>

With XAML you can do that with the Button.Borderbrush and LinearGradientBrush

eg

<Button x:Name="Button1" Height="40" Width="120" BorderThickness="2">
    <Button.BorderBrush>
        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" >
            <GradientStop Color="#d0b175" Offset="0" />
            <GradientStop Color="#624c23" Offset="1.0" />
        </LinearGradientBrush>
    </Button.BorderBrush>
    DONE
</Button>

You can add more colors in the gradient if you have to:

<GradientStop Color="#d0b175" Offset="0" />
<GradientStop Color="White" Offset="0.5" />
<GradientStop Color="#624c23" Offset="1.0" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM