前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >WPF Button TextBox 圆角

WPF Button TextBox 圆角

作者头像
hbbliyong
发布2018-03-05 15:20:35
2.2K0
发布2018-03-05 15:20:35
举报
文章被收录于专栏:hbbliyong
代码语言:javascript
复制
 <!--圆角button-->
    <Style TargetType="Button">
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Margin" Value="4"/>
        <Setter Property="FontWeight" Value="Black"/>
        <Setter Property="Foreground" Value="WhiteSmoke"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="#FFFF4300"/>
        <Setter Property="Width" Value="100"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="16" Name="PART_Background">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                <GradientStop Color="White" Offset="0.0" />
                                <GradientStop Color="#FFFF4300" Offset="0.5" />
                                <GradientStop Color="White" Offset="0.0" />
                            </LinearGradientBrush>
                        </Border.Background>
                        <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 TextBox圆角

代码语言:javascript
复制
 <Style TargetType="{x:Type TextBox}">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="BorderThickness" Value="6"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush  StartPoint="0,1" EndPoint="0,0">
                        <GradientStop Color="OrangeRed" Offset="0"/>
                        <GradientStop Color="#FFFFCB97" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <Grid>
                            <Rectangle RadiusX="5" RadiusY="5" Fill="{TemplateBinding Background}" Stroke="OrangeRed"  StrokeThickness="2"/>
                            <ScrollViewer x:Name="PART_ContentHost"
                          HorizontalScrollBarVisibility="Hidden"
                          VerticalScrollBarVisibility="Hidden"
                          Padding="{TemplateBinding Padding}"
                          Focusable="false">
                            </ScrollViewer>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2013-05-29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档