使用dsoframer演示ppt

优点:

(1)不用直接打开PowerPoint

(2)可以嵌入到Form中,那种先打开ppt然后将ppt嵌入到Form中的方式,会先打开PowerPoint

缺点:

很早就停止更新了。。。。  但是没办法还是这个好用

1.以管理员的身份运行程序

需要以管理员的身份运行程序(winform)

2.下载并注册dsoframer.ocx

dsoframer控件注册,解注册和检查注册情况

3.添加dsoframer控件

常规处,右键 点击“选择项”  点击“COM组件” 选中“DSO Framer Control Object” 确定 

 

4.使用方式

(1)打开方式:

axFramerControl1.Open(s, true, "PowerPoint.Show", "", "");

(2)Form全屏:

axFramerControl1.Focus();
SendKeys.SendWait("F5");

(3)上一张ppt

axFramerControl1.Focus();
SendKeys.SendWait("P");

(4)下一张ppt

axFramerControl1.Focus();
SendKeys.SendWait("N");

(5)截图

axFramerControl1.Focus();
SendKeys.Send("^A");

(6)电脑屏幕全屏(这样做,和PowerPoint软件F5播放效果一样)

需要引入:

 

axFramerControl1.Open(s, true, "PowerPoint.Show", "", "");

//全屏

objPresSet = axFramerControl1.ActiveDocument as Presentation;
objPresSet.SlideShowSettings.Run();

//关闭

if (objPresSet != null)
{
objPresSet.Close();
objPresSet = null;
}

(7)关闭

axFramerControl1.Close();

问题:

(1)当文件放在服务器上,且地址含有中文时,会报错:System.IO.FileNotFoundException:“指定资源下载失败。

像这种http://www.exaple.com/file/你好.pptx

解决:

Uri.EscapeUriString(filePath);

 (2)unable to display inactive document,click here to reactive the object

SendKeys.SendWait("F5");  之后 隐藏在显示 会出现ppt画面变为白板 显示文字“unable to display inactive document,click here to reactive the object”

解决:

ActivationPolicy = dsoKeepUIActiveOnAppDeactive

 

转载于:https://www.cnblogs.com/yaosj/p/10877567.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值