網頁 貼吧 文章 作者 工作  
網頁搜尋
 
 愛PO吧 >> 史萊姆好玩遊戲 >> 瀏覽文章
回覆 加入我的最愛 與好友分享

Wpf 如何做到msn的來電震動特效

本被文章 0 次, 共有回覆 2  
0
 
0
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Windows.Media.Animation; namespace DemoGridAni{ /// /// Interaction logic for Window1.xaml /// public partial class Window1 : Window { private bool _ISACTIVE; public Window1() { InitializeComponent(); } private double rect = 10; private int dotime = 0; private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (!_ISACTIVE) { _ISACTIVE = true; Doani(); } } private void Doani() { Console.WriteLine("Doani"); DoubleAnimation da1 = new DoubleAnimation(); da1.From = this.Top; da1.To = this.Top + rect; da1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 15)); da1.Completed += new EventHandler(da1_Completed); this.BeginAnimation(Window.TopProperty, da1); } void da1_Completed(object sender, EventArgs e) { Console.WriteLine("da1_Completed"); DoubleAnimation da2 = new DoubleAnimation(); da2.From = this.Left; da2.To = this.Left + rect; da2.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 15)); da2.Completed += new EventHandler(da2_Completed); this.BeginAnimation(Window.LeftProperty, da2); } void da2_Completed(object sender, EventArgs e) { DoubleAnimation da3 = new DoubleAnimation(); da3.From = this.Top; da3.To = this.Top - rect; da3.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 15)); da3.Completed += new EventHandler(da3_Completed); this.BeginAnimation(Window.TopProperty, da3); } void da3_Completed(object sender, EventArgs e) { DoubleAnimation da4 = new DoubleAnimation(); da4.From = this.Left; da4.To = this.Left - rect; da4.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 15)); da4.Completed += new EventHandler(da4_Completed); this.BeginAnimation(Window.LeftProperty, da4); } void da4_Completed(object sender, EventArgs e) { if (dotime > 7) { _ISACTIVE = false; dotime = 0; } else { dotime++; System.Threading.Thread.Sleep(50); Doani(); } } }}

逛上一篇:   逛下一篇:

作者: ebqukpae
  (2010-01-26 15:36)
推薦文章: 將本文章推薦到【百度收藏】 將本文章推薦到【YouPush】 將本文章推薦到【udn共享書籤】 將本文章推薦到【Fiigo】書籤

 本文章共有回覆 2 篇,分 1 頁
 聲明:以上內容不代表本站立場,且內容由網友發表提供,若有爭議或違法由發表者承擔,本站將不負責連帶責任,謝謝。

 IPoBar  愛PK  愛遊戲  愛online
新手教學 客服中心 站務公告 交換連結 合作提案 關於我們
 
版權所有©ipobar Ltd., All Rights Reserved.
論壇內會員言論僅代表個人觀點,不代表本站同意其說法,本討論區不承擔由該言論所引起的法律責任