none
How to advance through slides with animations fast? RRS feed

  • Question

  • Hi,

    I've embedded powerpoint in my C# application. At the bottom of the screen I have a previous & next button to control the presentation. The code for the next button looks like this:

            public void NextSlide()
            {
    
                //Activate is used so I can have multiple animations in one slide
                _pres.SlideShowWindow.Activate();
    
                _pres.SlideShowWindow.View.Next();
    
            }

    The problem is that, sometimes my GUI locks up while the presentation transitions from one slide to another with long animations..So I thought, putting the actions of my NextSlide method in a separate thread: this helps for not locking up the gui. But now everytime I click next too fast, the same slide is shown and animated again.

    To sum it up, I want the same behaviour as is used in Ms Powerpoint, this means, when clicking on the next slide, if an animation was playing it gets killed and the next slide is shown instantly.

    Can somebody put me on the right direction with this one?

    Wednesday, May 2, 2012 11:50 AM

Answers

  • Hi,

    I observed different behavior as you described: depending on how many animations on a slides, it takes same number of mouse click to go through the animations. SlideShowWindow.View.Next API does same thing as mouse click.  If a long-running animation is playing, a mouse click just stops this animation. Given there're multiple animations on a slide, user have to call SlideShowWindow.View.GotoSlide (next slide index) to go to next slide. Based on this idea, general process for your requirement is:

    Sub NextSlide()
    
    ActivePresentation.SlideShowWindow.Activate
          
    If ActivePresentation.SlideShowWindow.View.CurrentShowPosition < ActivePresentation.Slides.Count Then
        ActivePresentation.SlideShowWindow.View.GotoSlide (ActivePresentation.SlideShowWindow.View.CurrentShowPosition + 1)
    Else: ActivePresentation.SlideShowWindow.View.Next
        
    End If

    Note:

    This method skip all animation, just step to next slide.  You can translate VBA code to C#.

    Hope this gets you started.


    Forrest Guo | MSDN Community Support | Feedback to manager

    Friday, May 4, 2012 5:37 AM
    Moderator

All replies

  • Hi DaanDL,

    Thanks for posting in the MSDN Forum.

    I will involve some experts into this thread to see whether they can help you. There might be some time delay, appricate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, May 3, 2012 5:34 AM
    Moderator
  • Hi,

    I observed different behavior as you described: depending on how many animations on a slides, it takes same number of mouse click to go through the animations. SlideShowWindow.View.Next API does same thing as mouse click.  If a long-running animation is playing, a mouse click just stops this animation. Given there're multiple animations on a slide, user have to call SlideShowWindow.View.GotoSlide (next slide index) to go to next slide. Based on this idea, general process for your requirement is:

    Sub NextSlide()
    
    ActivePresentation.SlideShowWindow.Activate
          
    If ActivePresentation.SlideShowWindow.View.CurrentShowPosition < ActivePresentation.Slides.Count Then
        ActivePresentation.SlideShowWindow.View.GotoSlide (ActivePresentation.SlideShowWindow.View.CurrentShowPosition + 1)
    Else: ActivePresentation.SlideShowWindow.View.Next
        
    End If

    Note:

    This method skip all animation, just step to next slide.  You can translate VBA code to C#.

    Hope this gets you started.


    Forrest Guo | MSDN Community Support | Feedback to manager

    Friday, May 4, 2012 5:37 AM
    Moderator