zoukankan      html  css  js  c++  java
  • 一个IMAGE BUTTON

    <ControlTemplate x:Key="UserButton" TargetType="{x:Type Button}">
              <Grid>
                   <Image x:Name="defaultimage" HorizontalAlignment="Stretch" Width="210" Height="55" Stretch="None" Source="b4.png"/>
                   <Image x:Name="forcusimage" HorizontalAlignment="Stretch" Width="210" Height="55" Stretch="None" Panel.ZIndex="10" Source="b5.png" Visibility="Hidden"/>
                   <TextBlock x:Name="text" Margin="0" TextWrapping="Wrap" Text="click button"  HorizontalAlignment="Center" Panel.ZIndex="100"/>
               </Grid>
               <ControlTemplate.Triggers>
                   <Trigger Property="IsEnabled" Value="False">

                   </Trigger>
               </ControlTemplate.Triggers>
           </ControlTemplate>
           <ControlTemplate x:Key="UserButton1" TargetType="{x:Type Button}">
               <Grid>
                   <Image Name="img" Source="/b4.png"/>
                   <!--TextBlock Name="text" Text="文字" HorizontalAlignment="Center" VerticalAlignment="Center"/-->
                   <ContentPresenter  HorizontalAlignment="Center" VerticalAlignment="Center"/>
               </Grid>
               <ControlTemplate.Triggers>
                   <Trigger Property="IsEnabled" Value="False">
                       <Setter TargetName="img" Property="Source" Value="/b5.png">
                       </Setter>
                   </Trigger>
                   <Trigger Property="IsMouseOver" Value="True">
                       <Setter TargetName="img" Property="Source" Value="/b6.png">
                       </Setter>
                       <Trigger.EnterActions>
                           <BeginStoryboard>
                               <Storyboard>
                                   <DoubleAnimation Storyboard.TargetName="img" Storyboard.TargetProperty="Width" From="150" To="200" Duration="0:0:0.1" />
                               </Storyboard>
                           </BeginStoryboard>
                       </Trigger.EnterActions>
                       <Trigger.ExitActions>
                           <BeginStoryboard>
                               <Storyboard>
                                   <DoubleAnimation Storyboard.TargetName="img" Storyboard.TargetProperty="Width" From="200" To="150" Duration="0:0:0.1" />
                               </Storyboard>
                           </BeginStoryboard>
                       </Trigger.ExitActions>
                   </Trigger>
               </ControlTemplate.Triggers>
           </ControlTemplate>

    //调用

    <Button  Content="文字" Width="150" Tag="zoomout" ToolTip="放大" Template="{StaticResource  UserButton1}" />

    单片机,嵌入式LINUX技术交流群:142282597
  • 相关阅读:
    BZOJ2301——莫比乌斯&&整除分块
    2019HDU多校第五场A fraction —— 辗转相除法|类欧几里得
    AKS素性检测
    2019牛客多校B generator 1——十进制快速幂
    BZOJ 3884——欧拉降幂和广义欧拉降幂
    libevent HTTP client 的实现
    google proto buffer安装和简单示例
    setenv LD_LIBRARY_PATH
    Centos6.4下安装protobuf及简单使用
    lrzsz
  • 原文地址:https://www.cnblogs.com/qiujiahong/p/3316615.html
Copyright © 2011-2022 走看看