我想制作一个能够开始、暂停、停止、关闭测验演示的表单控件(按下开始时将运行倒计时)。问题是在某些演示文稿中,有可用的视频(每张幻灯片最多只能包含 1 个视频,并且并非每张幻灯片都包含它)。
这些是我在 createPresentation 方法中用于添加视频的一些代码片段:
PowerPoint.Slides oSlides = null;
PowerPoint.Slide oSlide = null;
int ctrSoal = 0;
foreach (CQuestion myQuestion in Global.questions)
{
ctrSoal++;
oSlides = oPre.Slides;
oSlide = oSlides.Add(ctrSoal, PowerPoint.PpSlideLayout.ppLayoutTextAndTwoObjects);
oShape2 = oSlide.Shapes[4];
oSlide.Shapes.AddMediaObject(System.IO.Path.Combine(Global.myVideoLocation, myQuestion.video), oShape2.Left, oShape2.Top, oShape2.Width, oShape2.Height);
到目前为止,我已经从这个 link 中尝试了一些解决方案
private void startToolStripMenuItem_Click(object sender, EventArgs e)
{
PowerPoint.Slides oSlides = null;
PowerPoint.Slide oSlide = null;
int ctrSoal = 0;
foreach (CQuestion myQuestion in Global.questions)
{
ctrSoal++;
oSlides = oPre.Slides;
oSlide = oSlides.Add(ctrSoal, PowerPoint.PpSlideLayout.ppLayoutTextAndTwoObjects);
var playVideo = oSlide.TimeLine.MainSequence.FindFirstAnimationFor(oSlide);
}
questionIndex = oPre.SlideShowWindow.View.Slide.SlideIndex - 1;
questionId = myQuiz.questions[questionIndex].id;
if (labelTimer.Text != "Paused")
{
duration = 0;
duration += myQuiz.questions[questionIndex].durationMinute * 60;
duration += myQuiz.questions[questionIndex].durationSecond;
labelKeypadID.Text = "";
for (int i = 0; i < jumlahJawaban; i++)
{
arrChart[i] = 0;
}
}
}
但结果却给我一个错误:
invalid arguments cannot convert from Microsoft.Office.Interop.PowerPoint.Slide to Microsoft.Office.Interop.PowerPoint.Shape
我想要实现的目标是一个表单控件,它可以在用户按下开始按钮(倒计时运行)时播放视频,而不是在幻灯片放映时自动播放。
更新
我试过这个。程序可以正常运行,但视频仍然无法播放。
PowerPoint.Shapes objShapes = null;
objShapes = oPre.Slides[1].Shapes;
foreach (Microsoft.Office.Interop.PowerPoint.Shape s in objShapes)
{
if (s.Name.Contains(".wmv"))
{
s.AnimationSettings.PlaySettings.PlayOnEntry = Office.MsoTriState.msoTrue;
}
}
更新 @jonPall
我试过这个:
PowerPoint.Slide oSlide = null;
PowerPoint.Shape objShape = null;
PowerPoint.Slides oSlides = null;
PowerPoint.Shapes objShapes = null;
int ctrSoal = 1;
oSlides = oPre.Slides;
oSlide = oSlides.Add(ctrSoal, PowerPoint.PpSlideLayout.ppLayoutTextAndTwoObjects);
objShapes = oPre.Slides[1].Shapes;
var playVideo = oSlide.TimeLine.MainSequence.FindFirstAnimationFor(objShape);
playVideo.Timing.TriggerType = PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious;
我的程序可以正常运行,但是当我按下开始(播放视频和运行倒数计时器)时出现错误
Sequence (unknown member) : Illegal value. Object does not exist.
更新 @Andy
PowerPoint.Slide oSlide = null;
PowerPoint.Slides oSlides = null;
PowerPoint.Shapes objShapes = null;
int ctrSoal = 1;
oSlides = oPre.Slides;
oSlide = oSlides.Add(ctrSoal, PowerPoint.PpSlideLayout.ppLayoutTextAndTwoObjects);
int indexSlide = oPre.SlideShowWindow.View.Slide.SlideIndex;
objShapes = oPre.Slides[indexSlide].Shapes;
foreach (Microsoft.Office.Interop.PowerPoint.Shape objShape in objShapes) {
string extension = Path.GetExtension(objShape.Name);
if (extension == ".wmv") {
//MessageBox.Show("Video Available");
var playVideo = oSlide.TimeLine.MainSequence.FindFirstAnimationFor(objShape);
playVideo.Timing.TriggerType = PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious;
}
}
使用上面的脚本我可以检测事件幻灯片中是否包含视频
但是 ~var~ playVideo 在包含视频的幻灯片中仍然为 null
我哪里不见了?
最佳答案
试试这个:
playVideo.Timing.TriggerType = PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious;
关于c# - 从表单控件 winform 播放和暂停视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22240109/
我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib
我有一个服务模型/表及其注册表。在表单中,我几乎拥有服务的所有字段,但我想在验证服务对象之前自动设置其中一些值。示例:--服务Controller#创建Action:defcreate@service=Service.new@service_form=ServiceFormObject.new(@service)@service_form.validate(params[:service_form_object])and@service_form.saverespond_with(@service_form,location:admin_services_path)end在验证@ser
如何在ruby中调用C#dll? 最佳答案 我能想到几种可能性:为您的DLL编写(或找人编写)一个COM包装器,如果它还没有,则使用Ruby的WIN32OLE库来调用它;看看RubyCLR,其中一位作者是JohnLam,他继续在Microsoft从事IronRuby方面的工作。(估计不会再维护了,可能不支持.Net2.0以上的版本);正如其他地方已经提到的,看看使用IronRuby,如果这是您的技术选择。有一个主题是here.请注意,最后一篇文章实际上来自JohnLam(看起来像是2009年3月),他似乎很自在地断言RubyCL
我正在尝试在Ruby中复制Convert.ToBase64String()行为。这是我的C#代码:varsha1=newSHA1CryptoServiceProvider();varpasswordBytes=Encoding.UTF8.GetBytes("password");varpasswordHash=sha1.ComputeHash(passwordBytes);returnConvert.ToBase64String(passwordHash);//returns"W6ph5Mm5Pz8GgiULbPgzG37mj9g="当我在Ruby中尝试同样的事情时,我得到了相同sha
C#实现简易绘图工具一.引言实验目的:通过制作窗体应用程序(C#画图软件),熟悉基本的窗体设计过程以及控件设计,事件处理等,熟悉使用C#的winform窗体进行绘图的基本步骤,对于面向对象编程有更加深刻的体会.Tutorial任务设计一个具有基本功能的画图软件**·包括简单的新建文件,保存,重新绘图等功能**·实现一些基本图形的绘制,包括铅笔和基本形状等,学习橡皮工具的创建**·设计一个合理舒适的UI界面**注明:你可能需要先了解一些关于winform窗体应用程序绘图的基本知识,以及关于GDI+类和结构的知识二.实验环境Windows系统下的visualstudio2017C#窗体应用程序三.
动漫制作技巧是很多新人想了解的问题,今天小编就来解答与大家分享一下动漫制作流程,为了帮助有兴趣的同学理解,大多数人会选择动漫培训机构,那么今天小编就带大家来看看动漫制作要掌握哪些技巧?一、动漫作品首先完成草图设计和原型制作。设计草图要有目的、有对象、有步骤、要形象、要简单、符合实际。设计图要一致性,以保证制作的顺利进行。二、原型制作是根据设计图纸和制作材料,可以是手绘也可以是3d软件创建。在此步骤中,要注意的问题是色彩和平面布局。三、动漫制作制作完成后,加工成型。完成不同的表现形式后,就要对设计稿进行加工处理,使加工的难易度降低,并得到一些基本准确的概念,以便于后续的大样、准确的尺寸制定。四、
2022/8/4更新支持加入水印水印必须包含透明图像,并且水印图像大小要等于原图像的大小pythonconvert_image_to_video.py-f30-mwatermark.pngim_dirout.mkv2022/6/21更新让命令行参数更加易用新的命令行使用方法pythonconvert_image_to_video.py-f30im_dirout.mkvFFMPEG命令行转换一组JPG图像到视频时,是将这组图像视为MJPG流。我需要转换一组PNG图像到视频,FFMPEG就不认了。pyav内置了ffmpeg库,不需要系统带有ffmpeg工具因此我使用ffmpeg的python包装p
Transformers开始在视频识别领域的“猪突猛进”,各种改进和魔改层出不穷。由此作者将开启VideoTransformer系列的讲解,本篇主要介绍了FBAI团队的TimeSformer,这也是第一篇使用纯Transformer结构在视频识别上的文章。如果觉得有用,就请点赞、收藏、关注!paper:https://arxiv.org/abs/2102.05095code(offical):https://github.com/facebookresearch/TimeSformeraccept:ICML2021author:FacebookAI一、前言Transformers(VIT)在图
我仍然收到标题中的“错误”消息,但不知道如何解决。在ApplicationController中,classApplicationController在routes.rb#match'set_activity_account/:id/:value'=>'users#account_activity',:as=>:set_activity_account--thisdoesn'tworkaswell..resources:usersdomemberdoget:action_a,:action_bendcollectiondoget'account_activity'endend和User
我在事件管理员编辑页面中有嵌套资源,但我只想允许管理员编辑现有资源的内容,而不是添加新的嵌套资源。我的代码看起来像这样:formdo|f|f.inputsdof.input:authorf.input:contentf.has_many:commentsdo|comment_form|comment_form.input:contentcomment_form.input:_destroy,as::boolean,required:false,label:'Remove'endendf.actionsend但它在输入下添加了“添加新评论”按钮。我怎样才能禁用它,并只为主窗体保留f.ac