Results 1 to 3 of 3

Thread: help animation wpf - vb

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2009
    Posts
    25

    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

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    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)
    ?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2009
    Posts
    25

    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
  •  



Click Here to Expand Forum to Full Width