开发者

C# - Show PowerPoint Presentations continous

I want to play some ppt files in a continuous loop, but when I open a new File after the first has reached its last slide, a new PowerPoint window opens and starts the Slide. How can I solve that problem?

        public Microsoft.Office.Interop.PowerPoint.SlideShowWindow startppt(string pptDatei)
    {
        WatchingLabel.Text = "Präsentation läuft...";
        started = true;
        ende = false;
        objPres = ppApp.Presentations.Open(pptDatei, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue);

        objPres.SlideShowSettings.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue;
        presWin = objPres.SlideShowSettings.Run();

        return presWin;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        WatchingLabel.Text = "Watching...";

        if (System.IO.Directory.Exists(ordner))
        {
            pptDatei.Clear();
            pptDatei.AddRange(System.IO.Directory.GetFiles(ordner, "*.ppt"));

            if (started == true && presWin.View.State == Microsoft.Office.Interop.PowerPoint.PpSlideShowState.ppSlideShowDone)
            {
                objPres.Close();
                ende = true;
                started = false;
            }

            if (pptDatei.Count > 0 && ende && started == false)
           开发者_开发知识库 {
                if (index < pptDatei.Count)
                {
                    startppt(pptDatei[index]);
                    index += 1;
                }
                else
                {
                    index = 0;
                }
            }
            else if (pptDatei.Count > 0 && ende == false && started == true)
            {
                presWin.View.Next();
            }

        }
    }

    public void ppApp_PresentationClose(Microsoft.Office.Interop.PowerPoint.Presentation Pres) 
    {
        pptDatei = new List<string>();
        started = false;
        ende = true;
        WatchingLabel.Text = "Präsentation beenden...";
    }

    public void ppApp_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres) 
    {
        ende = true;
        started = false;
    }


Unfortunately, no, you can't do this with multiple PowerPoint files. Prior to PowerPoint 2010, you cannot have more than one PPT running at the same time (and even with PP2010 it's wonky to do so). So by shutting one down and opening a new one to run, you lose the main run window.

You could create multiple PowerPoint instance, set them as visible/hidden and then when one slideshow ends, programmatically unhide the next one and display it to run, but that would suffer from the same flicker issue as you already have.

The best you can do is read all the ppts in the directory, merge them all into a new deck in the order you need (and specifying layouts, etc.) and then run that single deck in a kiosk-loop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜