定制Powerpoint幻灯片
我只使用 C# 几个星期,但我却陷入了线程问题。
我一直在构建一个自定义幻灯片,它实现了托管在由独立类处理的 winform 中的 .ppt 演示文稿。幻灯片放映结束后,另一个程序显示车间的动态数据。需要向第二个程序发送命令以进入全屏模式,因为我无权访问它的源代码。
使用 Setforegroundwindow API,我可以轻松地在两个应用程序之间切换,并使用 COM 接口控制电源点,但随着屏幕大小的调整,过渡会变得不稳定。我想覆盖一个空白的黑色 winform,在发生这种转换时淡入淡出。到目前为止,我还没有成功地做到这一点,我已经尝试在单独的线程上运行淡入淡出形式和过渡,但我还没有完全弄清楚。如果有人对如何做到这一点有任何建议,我们将不胜感激。
谢谢。
I have only been working with C# for a few weeks and I have gotten stuck on a threading issue.
I've been building a custom slideshow that implements a .ppt presentation hosted in a winform handled by an independent class. The slideshow switches off with another program that displays dynamic data from a shop floor. This second program needs to be sent a command to enter full screen mode as I do not have access to it's source code.
Using Setforegroundwindow API I can easily switch between the two applications and control the power point with the COM interface but the transition is choppy with screens resizing. I would like to overlay a blank black winform that fades in and out while this transition occurs. So far I have been unsuccessful in doing this smoothly, I have tried running the fading form and transition on separate threads but I haven't got it quite figured out. If anyone might have any advice on how to do this it would be much appreciated.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种想法...
有两个 ppt 加载器。
当前的和您正在加载的新的。
保持当前的可见和活动状态,直到新的准备就绪。然后,一旦新的准备好,就隐藏当前的。这应该会给你一个很好的过渡。
由于将有两个观看者处于活动状态,因此资源消耗会更大一些,但切换应该会更流畅。
可能想要区分加载和启动。这样您就可以在后台加载,加载后,显示并启动 ppt。
One thought...
Have two ppt loaders.
The current one and the new one you are loading.
Keep the current visible and active until the new one is ready. Then once the new one is ready hide the current one. That should give you a nice transition.
Since there will be two viewers active, it will be a little more resource intensive, but switching should be smoother.
Might want to distinquish loading versus starting. That way you can load behind the scenese and once loaded, show and start the ppt.
在完成一些示例代码之后,我实现了一个后台工作人员来完成这个任务。有关详细信息 来自 msdn - 如何:使用后台工作者。
我试图找到一种更可靠的方法来确保应用程序处理 F11 命令,但现在我在 SendKeys 之前放置了 Thread.Sleep。
请随时留下评论或问题。
以及淡入和淡出表单的代码..
After working through some example code I implemented a background worker that did the trick. For more info From msdn - How to: Use a Background Worker.
I'm trying to find a more reliable way to ensure the F11 command is processed by the application, but for now I've put in a Thread.Sleep before the SendKeys.
Please feel free to leave comments or questions.
And the code for the form that fades in and out..