zoukankan      html  css  js  c++  java
  • wpf 纯样式写按钮

     1 <!--自定义按钮样式-->
     2      <LinearGradientBrush x:Key="LinearGradientBlueBackground" EndPoint="0.5,1" StartPoint="0.5,0">
     3             <GradientStop Color="#FF377FED" Offset="0" />
     4             <GradientStop Color="#FF074CC0" Offset="1" />
     5         </LinearGradientBrush>
     6     <SolidColorBrush x:Key="MyBtnBorderColor" Color="#FF2D78F4" />
     7     <SolidColorBrush x:Key="MyBtnHoverBackgroundColor" Color="#3096FF" />
     8     <SolidColorBrush x:Key="MyBtnPressedBackgroundColor" Color="#0067CF" />
     9     <!--END-->
    10         
    11         <Style x:Key="StlLoginBtnStyle" TargetType="{x:Type Button}" >
    12         <Setter Property="Background" Value="{StaticResource LinearGradientBlueBackground}" />
    13         <Setter Property="Foreground" Value="#FFFFFF" />
    14         <Setter Property="FontSize" Value="36" />
    15         <Setter Property="FontFamily" Value="MicrosoftYaHei" />
    16         <Setter Property="Width" Value="560" />
    17         <Setter Property="Height" Value="100" />
    18         <Setter Property="BorderBrush" Value="{StaticResource MyBtnBorderColor}" />
    19         <Setter Property="Template">
    20                 <Setter.Value>
    21                     <ControlTemplate TargetType="{x:Type Button}">
    22                         <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" 
    23                                 SnapsToDevicePixels="true" CornerRadius="3,3,3,3">
    24                         <ContentPresenter x:Name="contentPresenter" 
    25                                               Focusable="False" 
    26                                               HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
    27                                               Margin="{TemplateBinding Padding}" 
    28                                               RecognizesAccessKey="True" 
    29                                               SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
    30                                               VerticalAlignment="{TemplateBinding VerticalContentAlignment}"  Content="立即登录"/>
    31                     </Border>
    32                         <ControlTemplate.Triggers>
    33                             <Trigger Property="IsMouseOver" Value="true">
    34                                 <Setter Property="Background" TargetName="border" Value="{StaticResource MyBtnHoverBackgroundColor}"/>
    35                             </Trigger>
    36                         <Trigger Property="IsPressed" Value="true">
    37                             <Setter Property="Background" TargetName="border" Value="{StaticResource MyBtnPressedBackgroundColor}" />
    38                         </Trigger>
    39                         </ControlTemplate.Triggers>
    40                     </ControlTemplate>
    41                 </Setter.Value>
    42             </Setter>
    43         </Style>
  • 相关阅读:
    在CHROME里安装 VIMIUM 插件, 方便操作
    Python 判断变量的类型
    Python 格式化输出
    ssh 使用
    [转载] 构造linux 系统下免密码ssh登陆  _How to establish password-less login with SSH
    [转载] SSH入门学习基础教程
    SSH 常用命令解析
    【转载】 调研文献的方法介绍,适用于各个领域
    POJ 2549 Sumsets
    HDU 5858 Hard problem
  • 原文地址:https://www.cnblogs.com/dotnetHui/p/8532353.html
Copyright © 2011-2022 走看看