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
  • 相关阅读:
    Makefile学习
    c语言中sprintf的语法
    word排版-先插入页码,再插入分页符
    word2007或2010插入或删除分隔符
    word中在插入空白页_例如,为了打印,在封面后面插入一页空白页
    在word中,整篇文章想要在每一章另起一页
    word2010如何在指定页面开始插入页码
    拨打美国国际长途
    Shell脚本之break,continue,和exit区别
    3.6.1 子串
  • 原文地址:https://www.cnblogs.com/qiujiahong/p/3316615.html
Copyright © 2011-2022 走看看