|
-
Nov 30th, 2009, 12:52 PM
#1
Thread Starter
Junior Member
help animation wpf - vb
Why not function?
please!
Code:
<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
-
Dec 3rd, 2009, 04:47 AM
#2
Re: help animation wpf - vb
Why do you have a space in this line?
Code:
myDoubleAnimation2.Duration TimeSpan.FromMilliseconds(2000)
Shouldnt it be:
Code:
myDoubleAnimation2.Duration = TimeSpan.FromMilliseconds(2000)
?
-
Dec 3rd, 2009, 05:24 AM
#3
Thread Starter
Junior Member
Re: help animation wpf - vb
Error Paste....
this corret code
Code:
<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>
and
Code:
Imports System.Windows.Media.Animation
Class Window1
Private LL As New Windows.Controls.Label
Private Sub Window1_Loaded(ByVal sender As Object, ByVal ByVale 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|