Quantcast
Viewing all articles
Browse latest Browse all 14

WPF simle animation...need help

hello. My name is Lucian, I'm from Romania, i'm a student, first year to informatics and i am new to wpf.

I need to make a project for school. I have to animate some lines .

I've searched on the internet but ..Image may be NSFW.
Clik here to view.
Cry

Let me explain a little. I must make a line appear pretty slow and when the line appears, there must be played a sound. So the appearance and the sound(mp3 must take action, both in the same time.

 

this is the code:

 

<Window x:Class="triunghipenote.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="439" Width="725">
    <Grid>
        <Canvas Height="104" HorizontalAlignment="Left" Margin="74,24,0,0" Name="Canvas1" VerticalAlignment="Top" Width="164" />
        <Line x:Name="linia0"
                    X1="150" Y1="150"
                    X2="350" Y2="290"
                    Stroke="Black"
                    StrokeThickness="3" Margin="-9,-12,0,0" />
        <Line x:Name="linia1"
    X1="142" Y1="138"
    X2="300" Y2="50"
    Stroke="Black"
    StrokeThickness="3" />
        <Line x:Name="linia2"
    X1="299" Y1="51"
    X2="340" Y2="278"
    Stroke="Black"
    StrokeThickness="3" />
        <Line x:Name="linia3"
    X1="142" Y1="138"
    X2="320" Y2="164"
    Stroke="Red"
    StrokeThickness="4" />
        <Line x:Name="linia4"
    X1="300" Y1="50"
    X2="240" Y2="207"
    Stroke="Red"
    StrokeThickness="4" />
        <Line x:Name="linia5"
    X1="340" Y1="278"
    X2="220" Y2="93"
    Stroke="Red"
    StrokeThickness="4" />
        <StackPanel x:Name="rootElement">
            <StackPanel.Resources>
                  <Storyboard x:Name="mystoryboard">
                    <DoubleAnimation
                        Storyboard.TargetName="linia0"
                        Storyboard.TargetProperty="Opacity"
                        From="0.0" To="1.0" Duration="0:0:3"
                        AutoReverse="False"  />
                    <DoubleAnimation
                        Storyboard.TargetName="linia1"
                        Storyboard.TargetProperty="Opacity"
                        From="0.0" To="1.0" Duration="0:0:3"/>
                </Storyboard>
            </StackPanel.Resources>

            <Button Content="Click" Height="42" Name="button12" Width="53" Click="button12_Click" />
        </StackPanel>
    </Grid>
</Window>

 

it gives me an error: all object s added to an Idictionary

have Key attribute or some other type of associated Key

i want to make this: at the begining, the windwos must be white, then after i click the buttn, the lines should apear, one by one, accompanied by sound..

I am using VB 2010

 

 


Viewing all articles
Browse latest Browse all 14

Trending Articles