日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
C++實現(xiàn)WPF動畫具體操作方法詳解

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

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

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

 
 
 
  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++實現(xiàn)WPF動畫代碼所用的XAML如下

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

以上就是對C++實現(xiàn)WPF動畫的相關(guān)操作介紹。


當前名稱:C++實現(xiàn)WPF動畫具體操作方法詳解
標題來源:http://www.5511xx.com/article/coddgpo.html