當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET Animatable.GetAnimationBaseValue方法代碼示例

本文整理匯總了VB.NET中System.Windows.Media.Animation.Animatable.GetAnimationBaseValue方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Animatable.GetAnimationBaseValue方法的具體用法?VB.NET Animatable.GetAnimationBaseValue怎麽用?VB.NET Animatable.GetAnimationBaseValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。


在下文中一共展示了Animatable.GetAnimationBaseValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: New

'
'
'   This sample shows how to use the 
'   Animatable.GetAnimationBaseValue and 
'   UIElement.GetAnimationBaseValue methods
'   to get the non-animated value of an
'   animated Animatable or UIElement.
'
'

Imports System.Windows
Imports System.Windows.Navigation
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports System.Windows.Controls
Imports System.Windows.Input

Namespace Microsoft.Samples.Animation.TimingBehaviors


    Public Class GetAnimationBaseValueExample
        Inherits Page


        Private animatedRotateTransform As RotateTransform
        Public Sub New()

            WindowTitle = "GetAnimationBaseValue Example"
            Dim myPanel As New StackPanel()
            myPanel.Margin = New Thickness(20.0)

            ' Create a button.
            Dim animatedButton As New Button()
            animatedButton.Content = "Click Me"
            animatedButton.Width = 100
            animatedButton.Margin = New Thickness(100)

            ' Create and animate a RotateTransform and
            ' apply it to the button's RenderTransform
            ' property.
            animatedRotateTransform = New RotateTransform()
            animatedRotateTransform.Angle = 45
            Dim angleAnimation As New DoubleAnimation(0,360, TimeSpan.FromSeconds(5))
            angleAnimation.RepeatBehavior = RepeatBehavior.Forever
            animatedRotateTransform.BeginAnimation(RotateTransform.AngleProperty, angleAnimation)
            animatedButton.RenderTransform = animatedRotateTransform
            animatedButton.RenderTransformOrigin = New Point(0.5,0.5)
            ' Animate the button's width.
            Dim widthAnimation As New DoubleAnimation(120, 300, TimeSpan.FromSeconds(5))
            widthAnimation.RepeatBehavior = RepeatBehavior.Forever
            widthAnimation.AutoReverse = True
            animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation)

            ' Handle button clicks.
            AddHandler animatedButton.Click, AddressOf animatedButton_Clicked

            ' Add the button to the panel.
            myPanel.Children.Add(animatedButton)
            Me.Content = myPanel
        End Sub

        ' Display the base value for Button.Width and RotateTransform.Angle.
        Private Sub animatedButton_Clicked(ByVal sender As Object, ByVal e As RoutedEventArgs)
            Dim animatedButton As Button = CType(sender, Button)
            MessageBox.Show("Button width base value: " & animatedButton.GetAnimationBaseValue(Button.WidthProperty).ToString & vbLf & "RotateTransform base value: " & animatedRotateTransform.GetAnimationBaseValue(RotateTransform.AngleProperty).ToString)
        End Sub

    End Class

End Namespace
開發者ID:VB.NET開發者,項目名稱:System.Windows.Media.Animation,代碼行數:71,代碼來源:Animatable.GetAnimationBaseValue


注:本文中的System.Windows.Media.Animation.Animatable.GetAnimationBaseValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。