简体   繁体   English

使用C#Win Form嵌入PowerPoint Viewer

[英]Embed PowerPoint Viewer in C# Win Form

Is it possible to Embed a PowerPoint Viewer into a C# Windows Form? 是否可以将PowerPoint Viewer嵌入到C#Windows窗体中?

I am currently use the following code: 我目前使用以下代码:

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;

It shows the viewer on the form but the placement and sizing is wrong. 它在表单上显示查看器,但放置和大小调整是错误的。 How would one size and place it correctly. 如何正确放置和放置它。

Another option : 另一种选择
I have encountered the Aximp.exe application meant to be used for showing ActiveX controls on the Win Forms in C#. 我遇到过Aximp.exe应用程序,用于在C#中的Win Forms上显示ActiveX控件。 How would I use this with the PPT Viewer? 我如何在PPT Viewer中使用它?

See this link. 看到这个链接。 You can also display the ppt in a WebBrowser control. 您还可以在WebBrowser控件中显示ppt。 This might also be useful. 也可能有用。

用于放置改变objPres.SlideShowWindow.Top作为例子和以10 objPres.SlideShowWindow.Left至12,从而滑动件的左上角将在(12,10),其中左移它的水平和顶部移动它垂直向下。

感谢您的良好链接, http://support.microsoft.com/kb/304662有用的信息...这帮助了我:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM