silverlight   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了利用Path路径设计的按钮图标(Silverlight)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

  实现简单的按钮图标,鼠标移上时显示框,本样式只专注于图案,文字要另外调整ContentPresenter的位置 <Style x:Key="refresh_Btn" TargetType="button"> <Setter Property="Padding" Value="3"/> <Setter Property="borderThickness" Value="1"/> <S

利用Path路径设计的按钮图标(Silverlight)@H_772_23@@H_772_23@ 

利用Path路径设计的按钮图标(Silverlight)@H_772_23@@H_772_23@@H_772_23@

实现简单的按钮图标,鼠标移上时显示框,本样式只专注于图案,@L_673_1@要另外调整ContentPresenter的位置@H_772_23@

<Style x:Key="refresh_Btn" TargetType="Button">
  <Setter Property="Padding" Value="3"/>
  <Setter Property="BorderThickness" Value="1"/>
  <Setter Property="BorderBrush" Value="#005FADDD" />
  <Setter Property="BACkground" Value="Transparent" />
  <Setter Property="Template">
      <Setter.Value>
    <ControlTemplate TargetType="Button">
        <Grid>
      <VisualStateManager.VisualStateGroups>
          <VisualStateGroup x:Name="CommonStates">
        <VisualState x:Name="Normal"/>
        <VisualState x:Name="MouSEOver">
            <Storyboard>
          <ColorAnimation Duration="0:0:0.5" To="#FF5FADDD" 
	      Storyboard.TargetProperty="(Border.borderBrush).(SolidColorBrush.Color)" 
	      Storyboard.TargetName="BACkground" />          
            </Storyboard>
        </VisualState>
        <VisualState x:Name="Pressed" />
        <VisualState x:Name="Disabled">
            <Storyboard>
               <DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" 
                  Storyboard.TargetName="DisabledVisualElement"/>
            </Storyboard>
        </VisualState>
          </VisualStateGroup>
          <VisualStateGroup x:Name="FocusStates">
        <VisualState x:Name="Focused">
            <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" 
                  Storyboard.TargetName="FocusVisualElement"/>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="Unfocused"/>
          </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border x:Name="BACkground" BorderBrush="{TemplateBinding BorderBrush}" 
         BorderThickness="{TemplateBinding BorderThickness}" BACkground="Transparent" CornerRadius="0">
          <Grid BACkground="{TemplateBinding BACkgrounD}" Margin="1">
             <Path x:Name="PathIcon" Data="...(省略)" Fill="#036EB8" HorizontalAlignment="Center" VerticalAlignment="Center">

             </Path>
          </Grid>
      </Border>
      <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplatE}" 
          Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
          Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
      <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" IsHitTestVisible="false" Opacity="0" RadiusY="3" RadiusX="3"/>
      <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Margin="1" Opacity="0" RadiusY="2" RadiusX="2" 
          stroke="{x:Null}" strokeThickness="0"/>
        </Grid>
    </ControlTemplate>
      </Setter.Value>
  </Setter>
</Style>


 记录此方法,为日后项目中使用@H_772_23@

---- 记录完毕 -----@H_772_23@

大佬总结

以上是大佬教程为你收集整理的利用Path路径设计的按钮图标(Silverlight)全部内容,希望文章能够帮你解决利用Path路径设计的按钮图标(Silverlight)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。