本文整理汇总了VB.NET中System.Windows.Media.Animation.Timeline.CurrentGlobalSpeedInvalidated事件的典型用法代码示例。如果您正苦于以下问题:VB.NET Timeline.CurrentGlobalSpeedInvalidated事件的具体用法?VB.NET Timeline.CurrentGlobalSpeedInvalidated怎么用?VB.NET Timeline.CurrentGlobalSpeedInvalidated使用的例子?那么恭喜您, 这里精选的事件代码示例或许可以为您提供帮助。
在下文中一共展示了Timeline.CurrentGlobalSpeedInvalidated事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: New
'
'
' This example shows how to register for the
' CurrentGlobalSpeedInvalidated event
' using a Timeline.
'
'
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 TimelineCurrentGlobalSpeedInvalidatedExample
Inherits Page
Private currentTimeTextBlock As TextBlock
Public Sub New()
' Create a name scope.
NameScope.SetNameScope(Me, New NameScope())
WindowTitle = "GetAnimationBaseValue Example"
Dim myPanel As New StackPanel()
myPanel.Margin = New Thickness(20)
' Create a rectangle.
Dim animatedRectangle As New Rectangle()
With animatedRectangle
.Width = 100
.Height = 50
.Margin = New Thickness(50)
.Fill = Brushes.Orange
.Stroke = Brushes.Gray
.StrokeThickness = 2
End With
' Create a RotateTransform.
Dim animatedTransform As New RotateTransform()
animatedTransform.Angle = 0
Me.RegisterName("animatedTransform", animatedTransform)
animatedRectangle.RenderTransform = animatedTransform
animatedRectangle.RenderTransformOrigin = New Point(0.5, 0.5)
myPanel.Children.Add(animatedRectangle)
Me.Content = myPanel
' Create a TextBlock to show the storyboard's current time.
currentTimeTextBlock = New TextBlock()
myPanel.Children.Add(currentTimeTextBlock)
' Animate the RotateTransform's angle using a Storyboard.
Dim angleAnimation As New DoubleAnimation(0, 360, TimeSpan.FromSeconds(5))
angleAnimation.RepeatBehavior = RepeatBehavior.Forever
angleAnimation.AutoReverse = True
Storyboard.SetTargetName(angleAnimation, "animatedTransform")
Storyboard.SetTargetProperty(angleAnimation, New PropertyPath(RotateTransform.AngleProperty))
Dim theStoryboard As New Storyboard()
theStoryboard.Children.Add(angleAnimation)
' Register the CurrentGlobalSpeedInvalidated event.
' You must register for events before you begin
' the storyboard.
AddHandler angleAnimation.CurrentGlobalSpeedInvalidated, AddressOf angleAnimation_CurrentGlobalSpeedInvalidated
' Start the storyboard.
theStoryboard.Begin(animatedRectangle, True)
End Sub
Private Sub angleAnimation_CurrentGlobalSpeedInvalidated(ByVal sender As Object, ByVal e As EventArgs)
' Sender is the clock that was created for the DoubleAnimation.
Dim doubleAnimationClock As Clock = CType(sender, Clock)
' Update the TextBlock with the time of its parent.
currentTimeTextBlock.Text = doubleAnimationClock.Parent.CurrentTime.ToString()
End Sub
End Class
End Namespace
开发者ID:VB.NET开发者,项目名称:System.Windows.Media.Animation,代码行数:91,代码来源:Timeline.CurrentGlobalSpeedInvalidated
注:本文中的System.Windows.Media.Animation.Timeline.CurrentGlobalSpeedInvalidated事件示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论