Delphi - OleContainer - PowerPoint - 自动播放
下午好:-),在我的应用程序中,我使用 OleContainer 从 Microsoft Powerpoint 查看演示文稿。
我使用此代码加载和运行演示文稿文件:
with oleContainer do begin
Parent := mediaPanel; Left := 0; Top := 0;
Width := mediaPanel.Width; Height := mediaPanel.Height;
CreateObjectFromFile('C:\Users\Nanik\Desktop\Present.ppt', false);
Iconic := false; Visible := true; Run;
end;
演示文稿被创建为自动播放幻灯片(在 Microsoft PowerPoint 中工作),但在我的应用程序演示文稿中仍然< /strong> 在第一张幻灯片上。运行命令不对?
Good afternoon :-), in my application I use OleContainer to view presentation from Microsoft Powerpoint.
This code I use to load and run presentation file:
with oleContainer do begin
Parent := mediaPanel; Left := 0; Top := 0;
Width := mediaPanel.Width; Height := mediaPanel.Height;
CreateObjectFromFile('C:\Users\Nanik\Desktop\Present.ppt', false);
Iconic := false; Visible := true; Run;
end;
The presentation was created as autoplay slideshow (in Microsoft PowerPoint working), but in my application presentation was still on first slide. Run command isn't right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要 OleContainer 来在应用程序的容器内运行演示文稿。将面板容器放在表单中运行演示文稿并尝试此例程:
我手头没有文档,但我的想法是 Run.Width 和 Run.Height 必须以点为单位提供,而不是以点为单位提供像素。我将像素转换为点的可怜人解决方案就在这里,它在我的测试中对我有用......找到在您的环境中转换的正确方法取决于您。
假设您可以从 oPPTPres.SlideShowSettings.Run.HWND 属性获取演示文稿窗口的句柄,但这对我来说不起作用,因此调用了 FindWindow。
You do not need a OleContainer to run the presentation inside a container in your application. Put a panel container to run the presentation in your form and try this routine:
I do not have documentation at hand, but my thought is Run.Width and Run.Height must be provided in points, not in pixels. My poor man solution to convert pixels to points is here, and it works for me in my tests here... to find the correct way to convert in your environment is up to you.
Is supposed you can get the Handle of the presentation window from the
oPPTPres.SlideShowSettings.Run.HWND
property, but that does not work here for me, hence the FindWindow call.Run
是TOleContainer
的一种方法,它不是特定于任何类型的 OLE 对象(例如幻灯片演示文稿或位图图像)的方法。文档指出“调用 Run 以确保服务器应用程序正在运行..”。您需要调用对象特定的方法来对其进行操作,请参阅 PowerPoint 对象模型参考。示例代码:
虽然上面的演示文稿将以幻灯片形式运行,但它可能不是您想要的,因为它以全屏方式运行。我不知道如何在容器窗口中运行它。
Run
is a method ofTOleContainer
, it is not a method specific to any kind of OLE object, say, a power point presentation or a bitmap image.. Documentation states "Call Run to ensure that the server application is running..".You need to call object specific methods to operate on them, see PowerPoint Object Model Reference. Sample code:
Though the above will run the presentation as a slide show, it is probably not what you'd want because it runs in full screen. I have no idea how to run it in the container window..