0
我想連續循環播放一些ppt
文件,但是當第一個文件到達最後一張幻燈片後打開新文件時,會打開一個新的PowerPoint窗口並啓動幻燈片。 我該如何解決這個問題?連續循環顯示PowerPoint演示文稿
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;
}
@ user589216:只想跟進以查看下方是否回答您的問題 – 2011-04-05 20:51:17