我正在创建一个可以播放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在播放完最后一张幻灯片时启动...
发布于 2009-06-26 18:23:13
在PowerPoint设置中有一个选项:End with black side。您可以尝试查看COM中是否存在此选项并使用它。
https://stackoverflow.com/questions/1050437
复制相似问题