2009-08-11 116 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)左移,水平移動,頂部垂直移動。