- 浏览: 648089 次
- 性别:
- 来自: 石家庄
文章分类
最新评论
-
abao1:
老贾 在安装IDEA的过程中,在激活步骤时,按如下操作即可: ...
IntelliJ IDEA 2016注册方法和注册码 -
bo_hai:
./usr/bin/java: symbol lookup ...
jmagick安装步骤 -
wxcking:
不错的, 收藏一下
JAVA使用POI生成Excel文件 -
zgyfh:
大哥,密码是多少啊?zgyfh@tom.com谢谢了!新手学习 ...
WPF做的必备示例 -
记忆无泪:
jiasongmao 写道你的邮箱是多少,我可以发源代码到邮箱 ...
WPF做的必备示例
仿vista玻璃效果的按钮样式:
使用方法:
<Button HorizontalAlignment="Right" Margin="0,31,56,0" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Width="136" Height="40" Content="Button" Foreground="#FFFFFFFF"/>
注意要添加PresentationFreamwork.Classic引用。
对于第二个样式,需要引入xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
<Style x:Key="ButtonFocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Border> <Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="4"/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="GlassButtonStyle" TargetType="{x:Type Button}"> <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/> <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="BorderBrush" Value="{x:Static Microsoft_Windows_Themes:ClassicBorderDecorator.ClassicBorderBrush}"/> <Setter Property="BorderThickness" Value="3"/> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Padding" Value="0,0,1,1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <ControlTemplate.Resources> <Storyboard x:Key="Timeline1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grow" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="Timeline2"> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="grow" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"> <SplineColorKeyFrame KeyTime="00:00:00" Value="#00FFFFFF"/> </ColorAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grow" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Border Background="#4C000000" BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4"> <Border Background="#7F000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="0.5*"/> <RowDefinition Height="0.5*"/> </Grid.RowDefinitions> <Border Opacity="0" Margin="0,0,0,0" x:Name="grow" CornerRadius="4,4,4,4" Grid.RowSpan="2"> <Border.Background> <RadialGradientBrush> <RadialGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform ScaleX="1.995" ScaleY="3.322"/> <SkewTransform AngleX="0" AngleY="0"/> <RotateTransform Angle="0"/> <TranslateTransform X="-0.453" Y="0.1"/> </TransformGroup> </RadialGradientBrush.RelativeTransform> <GradientStop Color="#FF26ECCD" Offset="0.249"/> <GradientStop Color="#00FFFFFF" Offset="1"/> </RadialGradientBrush> </Border.Background> </Border> <Border x:Name="shine" CornerRadius="4,4,0,0"> <Border.Background> <LinearGradientBrush EndPoint="0.5,2.167" StartPoint="0.5,-3.167"> <GradientStop Color="#FFFFFFFF" Offset="0"/> <GradientStop Color="#00FFFFFF" Offset="1"/> <GradientStop Color="#7DFFFFFF" Offset="0.335"/> </LinearGradientBrush> </Border.Background> </Border> <ContentPresenter HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center" Grid.RowSpan="2"/> </Grid> </Border> </Border> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter Property="Visibility" TargetName="grow" Value="Hidden"/> <Setter Property="Opacity" TargetName="shine" Value="0"/> </Trigger> <Trigger Property="IsKeyboardFocused" Value="true"/> <Trigger Property="IsDefaulted" Value="true"/> <Trigger Property="IsPressed" Value="true"/> <Trigger Property="ToggleButton.IsChecked" Value="true"/> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="Timeline1_BeginStoryboard" Storyboard="{StaticResource Timeline1}"/> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard x:Name="Timeline2_BeginStoryboard" Storyboard="{StaticResource Timeline2}"/> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
<Style x:Key="GlassButton" TargetType="Button"> <Setter Property="Background" Value="#FF1F3B53"/> <Setter Property="Foreground" Value="White"/> <Setter Property="Padding" Value="3"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderBrush"> <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFA3AEB9" Offset="0"/> <GradientStop Color="#FF8399A9" Offset="0.375"/> <GradientStop Color="#FF718597" Offset="0.375"/> <GradientStop Color="#FF617584" Offset="1"/> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="Normal"/> <vsm:VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Pressed"> <Storyboard> <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"> <SplineColorKeyFrame KeyTime="0" Value="#CC000000"/> </ColorAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="shine" Storyboard.TargetProperty="Opacity"> <SplineDoubleKeyFrame KeyTime="0" Value="0.4"/> </DoubleAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Visibility>Collapsed</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Disabled"> <!-- <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity"> <SplineDoubleKeyFrame KeyTime="0" Value=".55"/> </DoubleAnimationUsingKeyFrames> </Storyboard> --> </vsm:VisualState> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="FocusStates"> <vsm:VisualState x:Name="Focused"> <!--<Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard>--> </vsm:VisualState> <vsm:VisualState x:Name="Unfocused"/> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4"> <Border x:Name="border" Background="#7F000000" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="0.507*"/> <RowDefinition Height="0.493*"/> </Grid.RowDefinitions> <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4"> <Border.Background> <RadialGradientBrush> <RadialGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform ScaleX="1.702" ScaleY="2.243"/> <SkewTransform AngleX="0" AngleY="0"/> <RotateTransform Angle="0"/> <TranslateTransform X="-0.368" Y="-0.152"/> </TransformGroup> </RadialGradientBrush.RelativeTransform> <GradientStop Color="#B28DBDFF" Offset="0"/> <GradientStop Color="#008DBDFF" Offset="1"/> </RadialGradientBrush> </Border.Background> </Border> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/> <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0"> <Border.Background> <LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028"> <GradientStop Color="#99FFFFFF" Offset="0"/> <GradientStop Color="#33FFFFFF" Offset="1"/> </LinearGradientBrush> </Border.Background> </Border> </Grid> </Border> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
使用方法:
<Button HorizontalAlignment="Right" Margin="0,31,56,0" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Width="136" Height="40" Content="Button" Foreground="#FFFFFFFF"/>
注意要添加PresentationFreamwork.Classic引用。
对于第二个样式,需要引入xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
发表评论
-
wpf开源项目
2019-12-03 11:35 583SharpDevelop SharpDevelop是一款用 ... -
wpf datagrid样式
2014-12-23 22:42 1026http://www.iringo.cn/wpf-datag ... -
WPF 的全球化
2010-10-06 00:40 1360本主题介绍了您在编写面向全球市场的 Windows Pre ... -
WPF如何:对应用程序进行本地化
2010-10-06 00:28 1296本教程演示如何使用 LocBaml 工具创建本地化的应用程 ... -
WPF 全球化和本地化概述
2010-10-06 00:25 1686当您将自己的产品限制为只能通过一种语言使用时,您便将潜在的 ... -
WPF概述一
2010-02-03 10:59 0以前在工作之余学习了WPF,感觉WPF对于软件界面的表现不仅快 ... -
WPF中如何让程序支持国际化
2009-12-23 01:47 1631如果想让我们的应用程序支持多国语言,就像瑞星那么样支持中日英三 ... -
MediaElement详解
2009-12-23 09:32 1989MediaElement:播放器 MediaOpen ... -
WPF电子书
2010-01-18 10:47 1641一些好的电子书 -
WPF开发之mvvm插件
2010-01-18 10:45 1263该插件的使用请参见附件示例 -
WPF开发3D工具类
2010-01-18 10:44 1199请参见附件 -
使用WPFRibbonCTP开发类似于office 2007界面的WPF应用程序
2010-01-18 10:42 1430具体请参见附件 -
MediaElement详解
2009-10-29 14:00 1737MediaElement:播放器 MediaOp ... -
HLSL自定义渲染特效之完美攻略(中)
2009-10-23 15:40 1263通过上一节的解说,大家是否已经对HLSL有了较深刻的认识和理解 ... -
HLSL自定义渲染特效之完美攻略(上)
2009-10-23 15:15 2644Shader Effect中文名称为“渲染特效”或“滤镜”,W ... -
基于像素的图像合成(For Silverlight)
2009-10-23 14:36 1073本节我将为大家讲解如何在Silverlight平台上实现上一节 ... -
基于像素的图像合成(For WPF)
2009-10-23 14:33 2601传统的基于GDI或G ... -
WPF中如何让程序支持国际化
2009-09-18 11:48 1890如果想让我们的应用程序支持多国语言,就像瑞星那么样支持中日英三 ... -
WPF中的依赖属性
2009-09-17 10:57 1925依赖属性 (Dependency Property) ... -
ListBox(CheckListBox)样式
2009-07-31 11:42 2711样式代码: <Application.Resour ...
相关推荐
wpf仿iphone桌面翻页效果,不满足翻页条件则回滚当页,另外增加了左右翻页按钮。
wpf仿苹果桌面菜单按钮效果
WPF仿苹果菜单按钮效果
这是用Blend 4制作WPF应用程序玻璃效果按钮的图文教程 制作出来的按钮适应性好、灵活性高 纯代码写出来的,不需要PS或者AI资源
WPF超好看的玻璃按钮,仿Vista系统的玻璃效果,需要的朋友们下吧。
wpf创建玻璃效果按钮 文档一步一步示范整个过程
WPF玻璃效果&按钮自定义样式示例 效果图: http://www.hoount.com/picture/cindy/2012+01+15pm18-06-28.jpg
WPF仿苹果菜单按钮效果
WPF仿Windows7界面效果
wpf 实现实时毛玻璃(live blur)效果
WPF仿Vista那样的半透明漂亮窗体,需要的朋友可以下载来学习学习。
是用样式实现更改WPF默认按钮外观,效果很棒。
wpf 制作 玻璃效果的button 内附图文教程
Wpf毛玻璃效果实现.亲测可用. 本资源来自http://download.csdn.net/download/fengchun_doff/8006205 直接编译无法通过.移除了相关引用. 可以直接使用.因为是转的,最少积分共享给大家.
wpf玻璃透明效果 wpf玻璃透明效果 wpf玻璃透明效果
WPF仿QQ抖动窗体效果的源码实现 更多资源: http://cleopard.download.csdn.net
Wpf仿Iphone桌面翻页效果源码 功能介绍: Wpf仿Iphone桌面翻页效果,界面美观,不满足 翻页条件则回滚当页,另外增加了左右翻页按钮。
WPF实现超酷样式按钮
wpf仿win7效果,wpf技术,仿qq登陆界面
wpf做的一个圆形玻璃按钮,和window vista风格一样