博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Silverlight位图效果Effect学习笔记
阅读量:7024 次
发布时间:2019-06-28

本文共 2877 字,大约阅读时间需要 9 分钟。

今天学习了Silverlight中Effect.下面是我总结的。直接贴代码了

(1)前台代码

(2)后台代码

ContractedBlock.gif
ExpandedBlockStart.gif
View Code
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; //添加命名空间 using System.Windows.Media.Effects; namespace SLEffectDemo {
public partial class MainPage : UserControl {
public MainPage() {
InitializeComponent(); this.btnBlurEffect.Click += new RoutedEventHandler(btnBlurEffect_Click); this.btnBlurEffectAnimation.Click += new RoutedEventHandler(btnBlurEffectAnimation_Click); this.btnnDropShadowEffect.Click += new RoutedEventHandler(btnnDropShadowEffect_Click); this.btnnDropShadowEffectAnimation.Click += new RoutedEventHandler(btnnDropShadowEffectAnimation_Click); } void btnBlurEffect_Click(object sender, RoutedEventArgs e) {
Button btn = sender as Button; if (btn.Effect != null) {
btn.Effect = null; } else {
BlurEffect blurEffect = new BlurEffect(); blurEffect.Radius = 5; btn.Effect = blurEffect; } } void btnBlurEffectAnimation_Click(object sender, RoutedEventArgs e) {
this.myBlurEffectStoryboard.Begin(); } void btnnDropShadowEffect_Click(object sender, RoutedEventArgs e) {
Button btn = sender as Button; if (btn.Effect != null) {
btn.Effect = null; } else {
Color color=new Color(); color.A=255; color.B=50; color.R=50; color.G=50; DropShadowEffect dropShadowEffect = new DropShadowEffect(); dropShadowEffect.Color = color; dropShadowEffect.Direction = 800; dropShadowEffect.ShadowDepth = 25; dropShadowEffect.BlurRadius = 6; dropShadowEffect.Opacity = 0.5; btn.Effect = dropShadowEffect; } } void btnnDropShadowEffectAnimation_Click(object sender, RoutedEventArgs e) {
myDropShadowEffectStoryboard.Begin(); } } }

转载地址:http://lbsxl.baihongyu.com/

你可能感兴趣的文章
十五天精通WCF——第二天 告别烦恼的config配置
查看>>
CYQ.Data 轻量数据访问层(四) 构造数据单元列
查看>>
精美UI界面欣赏[12]
查看>>
UIButton的两种block传值方式
查看>>
深蓝词库转换1.5发布
查看>>
ORA-01033: ORACLE initialization or shutdown in progress
查看>>
得到设备是何种iPhone设备 + 怎么获得启动页面图片
查看>>
【Python】实现从AWR 报表上抓取指定数据改进版
查看>>
优化OEA中的聚合SQL
查看>>
15天玩转redis —— 第三篇 无敌的列表类型
查看>>
iozone 测试实例
查看>>
谈软件测试---一年测试工作总结
查看>>
Android实现Toast快速刷新
查看>>
jboss classloader机制以及scope配置
查看>>
PostgreSQL performance test use ssh tunnel
查看>>
【UWP应用开发实战】第二弹 移动版秒变桌面版 实践:罗马数计算器
查看>>
Java IO 之 FileInputStream & FileOutputStream源码分析
查看>>
时序列数据库武斗大会之什么是 TSDB ?
查看>>
fork() and vfork() getppid's result
查看>>
线程的其他特征
查看>>