2009-08-11 115 views
11

是否可以将PowerPoint Viewer嵌入到C#Windows窗体中?在C#Win表单中嵌入PowerPoint Viewer

我目前使用下面的代码:

objApp = new PowerPoint.Application(); 
     //objApp.Visible = MsoTriState.msoTrue; 
     objPresSet = objApp.Presentations; 
     objPres = objPresSet.Open(ppsAction.FileInfo.FullName, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse); 
     objSlides = objPres.Slides; 

     //Run the Slide show 
     objSSS = objPres.SlideShowSettings; 
     objSSS.ShowType = Microsoft.Office.Interop.PowerPoint.PpSlideShowType.ppShowTypeSpeaker; 
     objSSS.LoopUntilStopped = MsoTriState.msoTrue; 
     objSSS.Run(); 

     WindowWrapper handleWrapper = new WindowWrapper(objPres.SlideShowWindow.HWND); 
     SetParent(handleWrapper.Handle, this.ApplicationPanel.Handle); 
     this.ApplicationPanel.Visible = true; 
     objPres.SlideShowWindow.Height = ApplicationPanel.Height; 
     objPres.SlideShowWindow.Width = ApplicationPanel.Width; 
     objPres.SlideShowWindow.Top = 0; 
     objPres.SlideShowWindow.Left = 0; 

它显示的形式,但在布局上的观众和大小是错误的。人们如何确定尺寸并正确放置。

另一种选择:我也遇到意味着要用于显示的ActiveX的Aximp.exe应用
在C#中的赢窗体控件。我如何将这与PPT查看器一起使用?

+0

看这个答案。 http://stackoverflow.com/a/10271255/1257567正是你想要的。 – diogopalhais 2012-04-22 19:26:10

回答

4

请参阅this链接。您还可以在WebBrowser控件中显示ppt。 This可能也有用。

+0

我使用Web浏览器控制选项。虽然我必须更改PowerPoint 2007文档的某些设置。 – Soppus 2009-08-12 08:02:36

1

对于放置改变objPres.SlideShowWindow.Top到10例和objPres.SlideShowWindow.Left〜12这样的幻灯片的左上角会在( 12,10)左移,水平移动,顶部垂直移动。