偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

C++實(shí)現(xiàn)WPF動(dòng)畫(huà)具體操作方法詳解

開(kāi)發(fā) 后端
我們今天以一段代碼示例為大家詳細(xì)解讀了C++實(shí)現(xiàn)WPF動(dòng)畫(huà)的具體操作方法,希望大家可以以此為參考對(duì)象,來(lái)熟練掌握這一應(yīng)用技巧。

C++編程語(yǔ)言的應(yīng)方式非常廣泛,可以幫助我們輕松的實(shí)現(xiàn)許多功能需求。比如今天為大家介紹有關(guān)C++實(shí)現(xiàn)WPF動(dòng)畫(huà)的相關(guān)操作,就可以以一種簡(jiǎn)單的方式來(lái)實(shí)現(xiàn)。下面就讓我們一起來(lái)看看具體的操作方法吧。#t#

很多人都習(xí)慣使用Blend來(lái)幫助編輯XAML文件,生成很多動(dòng)畫(huà)。但在實(shí)際開(kāi)發(fā)中,用代碼來(lái)實(shí)現(xiàn)動(dòng)畫(huà)還是很實(shí)用的,而且代碼的邏輯開(kāi)發(fā)能力更強(qiáng),更容易控制,這方面C#的例子已經(jīng)很多了,下面我介紹幾個(gè)C++實(shí)現(xiàn)WPF動(dòng)畫(huà)的例子。

首先介紹少漸隱漸現(xiàn),也就是Alpha Animation。C++實(shí)現(xiàn)WPF動(dòng)畫(huà)代碼如下

  1. /**//*  
  2. * Take Label for example  
  3. */  
  4. // 1, Find the lable by its name, The name define in the xaml file  
  5. Label^ pColorLabel = (Label^)page->FindName("ColorAnimationLabel");  
  6. // 2, Define a DoubleAnimation object  
  7. DoubleAnimation^ pDoubleAnimation = gcnew DoubleAnimation();  
  8. // 3, Set from to and duration  
  9. pDoubleAnimation->From = 1;  
  10. pDoubleAnimation->To = 0;  
  11. pDoubleAnimation->DurationDuration = Duration(TimeSpan::FromSeconds(3));  
  12. // 4, Create a storyboard(Timeline)  
  13. Storyboard^ pStoryboard = gcnew Storyboard();  
  14. // 5, Set the DoubleAnimation's target name  
  15. pStoryboard->SetTargetName(pDoubleAnimation, _T("ColorAnimationLabel"));  
  16. // 6, Set the DoubleAnimation's property  
  17. pStoryboard->SetTargetProperty(pDoubleAnimation, 
    gcnew PropertyPath(Label::OpacityProperty));  
  18. // 7, Add the DoubleAnimation object to the storyboard  
  19. pStoryboard->Children->Add(pDoubleAnimation);  
  20. // 8, Start the animation  
  21. pStoryboard->Begin(pColorLabel); 

上面C++實(shí)現(xiàn)WPF動(dòng)畫(huà)代碼所用的XAML如下

  1. < Page 
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  4. > 
  5. < Grid> 
  6. < DockPanel> 
  7. < Button Name="ColorAnmationButton" Width="100" Height="50" 
    Background="LightBlue">Color Anmation< /Button> 
  8. < Label Name="ColorAnimationLabel" Width="200" 
    Height="50" Background="Red"> 
  9. < /Label> 
  10. < /DockPanel> 
  11. < /Grid> 
  12. < /Page> 

以上就是對(duì)C++實(shí)現(xiàn)WPF動(dòng)畫(huà)的相關(guān)操作介紹。

責(zé)任編輯:曹凱 來(lái)源: 博客園
相關(guān)推薦

2010-02-03 13:26:53

C++計(jì)時(shí)

2010-02-02 17:13:35

C++ Endian

2010-02-02 13:57:31

C++解析#pragm

2009-12-30 16:48:52

Silverlight

2010-04-02 08:42:32

Oracle 游標(biāo)

2010-01-27 18:00:57

Android開(kāi)機(jī)自啟

2010-02-01 14:33:05

C++實(shí)現(xiàn)RTTI

2010-03-05 15:27:06

Python文件路徑

2010-04-13 17:00:27

Oracle NLS_

2010-01-07 15:37:35

VB.NET ForNext循環(huán)

2010-01-28 16:14:33

Android安裝卸載

2009-12-31 15:36:13

SilverLight

2009-12-31 15:36:13

SilverLight

2010-03-19 14:19:58

Python正則表達(dá)式

2010-02-04 11:23:25

C++反射機(jī)制

2010-03-24 10:06:37

Python嵌入C++

2010-03-05 17:06:26

Python顯示UTF

2010-02-03 09:59:42

C++文件流操作

2009-12-28 16:10:38

WPF生成文件

2010-02-01 17:02:53

C++產(chǎn)生隨機(jī)數(shù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)