locked
A simple question (LEQUEM) - 4/9/2006 2:41 AM PST RRS feed

  • Question

  • By: LEQUEM

    Hello dear friends, 
    I'm discovering Interface designer and I'm testing severals things but I'm 
    blocking on a little problem.
    I'm using the design interface and I want to create an object with an 
    animation which start on an MouseMove event. My problem is that the animation 
    re-start each time I mouve the mouse. I would like to introduce a constrain 
    to launch the animation on the first MouseMouve event and no for the 
    following but I don't know how to do.
    
    Thank you for your help.
    
    Monday, February 18, 2008 11:41 PM

Answers

  • By: Unni Ravindranathan (MS)
    Hi Lequem,

    I won't try my VB skills any more - it took me some time to figure out that
    equivalent VB syntax for the code below :). Here is the C# code to figure
    out when an Storyboard ends:

    protected override void OnInitialized(EventArgs e)
    {
    base.OnInitialized(e);

    Storyboard s = this.Resources["Timeline1"] as Storyboard;
    s.CurrentStateInvalidated += new
    EventHandler(s_CurrentStateInvalidated);
    s.Begin(this);
    }

    void s_CurrentStateInvalidated(object sender, EventArgs e)
    {
    ClockGroup clockGroup = sender as ClockGroup;
    if (clockGroup.CurrentState == ClockState.Filling)
    {
    //Do you work here...
    MessageBox.Show("test");
    }
    }

    Also, I think your second question is that you could not find anything
    specific to Windows Presentation Foundation in .Net SDK. You need to look at
    the WinFX documentation for that (WinFX documentation also includes
    documentation for .Net 2.0) - you can view an online version here -
    http://windowssdk.msdn.microsoft.com/library/

    If you want an offline experience, you can install from
    http://www.microsoft.com/downloads/details.aspx?FamilyId=9BE1FC7F-0542-47F1-88DD-61E3EF88C402&displaylang=en

    Thanks,
    -Unni
    --
    This posting is provided "AS IS" with no warranties, and confers no rights.

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:C4E22E27-E6A9-4012-9E21-571EF1289F58@microsoft.com...

    Click to show or hide original message or reply text.


    Tuesday, February 19, 2008 5:26 PM

All replies

  • By: Unni Ravindranathan (MS)
    Wouldn't MouseEnter work for you?

    Thanks,
    -Unni

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:A1FC8F0A-8069-4564-A3E0-F417796E19A9@microsoft.com...

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 5:23 PM
  • By: LEQUEM
    Currently no but thank you for your response,

    I want to make a button who appears with a fade in effect when the mouse
    moves and diseapears with a fade out effect when the mouse stop.
    So the MouseEnter doesn't work but I think the best way to do what I want
    it's to do it by the code (unless you have an other solution).

    Whereas I am not really efficient in .NET, I'm programming in VB in
    Iinterface Designer. I don't know how to control an animation of a specific
    timeline by the code. Could you help me and give me an example?

    (For exemple: I want to launch/stop/resume the animation of the timeline
    named "MyTimeLine", what is the vb code to do this ?)

    Thank you for your help, best regards,

    LEQUEM

    "Unni Ravindranathan (MS)" wrote:

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 5:24 PM
  • By: Unni Ravindranathan (MS)
    Sure, the following is the code to begin a Storyboard.

    Dim s as Storyboard
    s = Me.FindResource("OnLoaded")
    s.Begin(Me)

    where the Storyboard is defined as a Resource in the Resource Dictionary of
    the root element. Does this answer your question?

    Thanks,
    -Unni
    --
    This posting is provided "AS IS" with no warranties, and confers no rights.

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:B3E0A697-71FA-4C3C-B7DD-C7D64CB29426@microsoft.com...

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 5:25 PM
  • By: LEQUEM
    Great! it's working, thank you again for your help.

    I have 2 others little questions to ask you, after I will accept your answers.

    The first one is: How can I wait (without freeze the application) and detect
    the end of an animation that I launch by the code to launch an other event?

    The second one is: Is exit an reference to code in VB with Interface
    Designer and where I can download it. I downloaded the SDK .NET 2 but there
    is nothing about story board and so on ...

    Thank you for your answers, best regards

    LEQUEM

    "Unni Ravindranathan (MS)" wrote:

    Click to show or hide original message or reply text.


    Tuesday, February 19, 2008 5:26 PM
  • By: Unni Ravindranathan (MS)
    Hi Lequem,

    I won't try my VB skills any more - it took me some time to figure out that
    equivalent VB syntax for the code below :). Here is the C# code to figure
    out when an Storyboard ends:

    protected override void OnInitialized(EventArgs e)
    {
    base.OnInitialized(e);

    Storyboard s = this.Resources["Timeline1"] as Storyboard;
    s.CurrentStateInvalidated += new
    EventHandler(s_CurrentStateInvalidated);
    s.Begin(this);
    }

    void s_CurrentStateInvalidated(object sender, EventArgs e)
    {
    ClockGroup clockGroup = sender as ClockGroup;
    if (clockGroup.CurrentState == ClockState.Filling)
    {
    //Do you work here...
    MessageBox.Show("test");
    }
    }

    Also, I think your second question is that you could not find anything
    specific to Windows Presentation Foundation in .Net SDK. You need to look at
    the WinFX documentation for that (WinFX documentation also includes
    documentation for .Net 2.0) - you can view an online version here -
    http://windowssdk.msdn.microsoft.com/library/

    If you want an offline experience, you can install from
    http://www.microsoft.com/downloads/details.aspx?FamilyId=9BE1FC7F-0542-47F1-88DD-61E3EF88C402&displaylang=en

    Thanks,
    -Unni
    --
    This posting is provided "AS IS" with no warranties, and confers no rights.

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:C4E22E27-E6A9-4012-9E21-571EF1289F58@microsoft.com...

    Click to show or hide original message or reply text.


    Tuesday, February 19, 2008 5:26 PM
  • By: LEQUEM
    Thank you for your help Unni, you were very helpfull.
    Moreover I discovered your blog, there is a bunch of good things so thanks
    you again.
    See you later for others questions ;)
    Best regards

    LEQUEM

    "Unni Ravindranathan (MS)" wrote:

    Click to show or hide original message or reply text.

    Tuesday, February 19, 2008 5:28 PM