【发布时间】:2011-04-27 20:44:06
【问题描述】:
我正在创建一个播放 powerpoint 幻灯片的 C# 应用程序。幻灯片放映结束后,我想停止 powerpoint 并再次返回我的程序。 我遇到的问题是我必须单击幻灯片的结尾才能返回我的程序...
有没有一种方法可以禁用等待点击?
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();
}
简而言之,SlideShowEnd 仅在播放完最后一张幻灯片并且我单击了演示文稿时触发。我希望 SlideShowEnd 在播放完最后一张幻灯片后触发...
【问题讨论】:
标签: c# powerpoint