【发布时间】:2011-01-25 15:58:53
【问题描述】:
我想连续循环播放一些ppt 文件,但是当我在第一个文件到达最后一张幻灯片后打开一个新文件时,会打开一个新的 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: 只是想跟进看看以下是否回答了您的问题
标签: c# .net ms-office powerpoint