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
  • 相关阅读:
    mysql环境搭建
    php基础:查看上次插入的主键和影响的行数及关闭mysql连接
    php基础:文件包含与引用 require和include的区别
    php基础:echo和print_r和var_dump的区别
    php基础:变量检测
    php基础:动态变量名
    php基础:代码的短路特性和运算符优先级
    php基础:三元运算符及比较3个数的大小
    php基础:字符串基本函数
    php基础:数组的定义和遍历
  • 原文地址:https://www.cnblogs.com/qiujiahong/p/3316615.html
Copyright © 2011-2022 走看看