Mirco Solato

Mirco Solato

  • NA
  • 87
  • 0

help animation wpf - vb

Nov 30 2009 12:49 PM
<Window x:Class="Window1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
Title="Window1" Height="300" Width="300">
<Grid Name="Grid1">
<Button Height="25" Width="50"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Name="Button1">Go</Button>
</Grid>
</Window>



Imports System.Windows.Media.Animation

Class Window1

Private LL As New Windows.Controls.Label

Private Sub Window1_Loaded(ByVal sender As Object, ByVal
e As System.Windows.RoutedEventArgs) Handles Me.Loaded

LL.Content = "dgkdjsjfklògjsòldfg"
LL.Name = "Label1"
LL.HorizontalAlignment Windows.HorizontalAlignment.Left
LL.VerticalAlignment Windows.VerticalAlignment.Top
LL.Foreground = Brushes.Black
LL.Visibility = Windows.Visibility.Visible

Me.Grid1.Children.Add(LL)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.Windows.RoutedEventArgs) Handles
Button1.Click

Dim sb As New Storyboard

Dim myDoubleAnimation As New DoubleAnimation
myDoubleAnimation.From = 0
myDoubleAnimation.To = 100
myDoubleAnimation.Duration TimeSpan.FromMilliseconds(2000)

Storyboard.SetTargetName(myDoubleAnimation,
"Label1")
Dim PropP As New PropertyPath(Canvas.LeftProperty)
Storyboard.SetTargetProperty(myDoubleAnimation,
PropP)

Dim myDoubleAnimation2 As New DoubleAnimation
myDoubleAnimation2.From = 0
myDoubleAnimation2.To = 100
myDoubleAnimation2.Duration TimeSpan.FromMilliseconds(2000)

Storyboard.SetTargetName(myDoubleAnimation2,
"Label1")
Dim PropP2 As New PropertyPath(Canvas.TopProperty)
Storyboard.SetTargetProperty(myDoubleAnimation2,
PropP2)

sb.Children.Add(myDoubleAnimation)
sb.Children.Add(myDoubleAnimation2)

Me.BeginStoryboard(sb)

End Sub

End Class




Why not function?

please!



Answers (3)