Domanda

Sto creando un'applicazione C # che riproduce una presentazione powerpoint. Al termine della presentazione, desidero interrompere Powerpoint e tornare nuovamente al mio programma. Il problema che sto riscontrando è che devo fare clic alla fine della presentazione per tornare al mio programma ...

Esiste un modo per disabilitare l'attesa di un clic?

private void ShowPresentation()
{
    String strPresentation, strPic;
    strPresentation = Application.StartupPath + "\\testje.ppt";

    bool bAssistantOn;

    //PowerPoint.Application objApp;
    PowerPoint.Presentations objPresSet;
    PowerPoint._Presentation objPres;
    PowerPoint.Slides objSlides;
    PowerPoint._Slide objSlide;
    PowerPoint.TextRange objTextRng;
    PowerPoint.Shapes objShapes;
    PowerPoint.Shape objShape;
    PowerPoint.SlideShowWindows objSSWs;
    PowerPoint.SlideShowTransition objSST;
    PowerPoint.SlideShowSettings objSSS;
    PowerPoint.SlideRange objSldRng;
    Graph.Chart objChart;

    //Create a new presentation based on a template.
    objApp = new PowerPoint.Application();
    objApp.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(powerpnt_SlideShowBegin);
    objApp.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(powerpnt_SlideShowEnd);
    objApp.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(powerpnt_SlideShowNextSlide);
    objApp.Visible = MsoTriState.msoTrue;
    objPresSet = objApp.Presentations;
    objPres = objPresSet.Open(strPresentation, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
    objSlides = objPres.Slides;

    //Prevent Office Assistant from displaying alert messages:
    bAssistantOn = objApp.Assistant.On;
    objApp.Assistant.On = false;

    //Run the Slide show from slides 1 thru 3.
    objSSS = objPres.SlideShowSettings;
    objSSS.StartingSlide = 1;
    objSSS.EndingSlide = objSlides.Count;
    objSSS.Run();
}

private void powerpnt_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres)
{
    objApp.Quit();
}

In poche parole, SlideShowEnd si attiva solo quando l'ultima diapositiva è stata riprodotta e ho fatto clic sulla presentazione. Voglio che SlideShowEnd si attivi quando viene riprodotta l'ultima diapositiva ...

È stato utile?

Soluzione

Nelle impostazioni di PowerPoint c'è un'opzione: Termina con il lato nero. Puoi provare a vedere se esiste nella COM e usarlo.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top