zoukankan      html  css  js  c++  java
  • WPF Button TextBox 圆角

    <!--圆角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圆角
    <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>
  • 相关阅读:
    LayoutInflater介绍及例子
    Java对象转换为Json对象
    重写Object.equals()方法和Object.hashCode()方法
    初步理解一下:SOA, SOAP, Web Service, WSDL等
    JSP九大内置对象及四个作用域
    Visual Studio的导入和导出设置
    winform三态树的构建和使用
    关于android编程使用android.hardware.Camera 方向不对的问题
    xampp软件包如何重置mysql的 密码
    有关.NET中的config文件的一些问题
  • 原文地址:https://www.cnblogs.com/sjqq/p/6637226.html
Copyright © 2011-2022 走看看