简体   繁体   English

VBA Power Point单击更改图像边框颜色

[英]vba power point changing image border color on click

I'm trying to make an educational interactive presentation for kinder children using Power Point, and I'm trying to do a kind of test/activity in which the children have to click on some pictures according to the question. 我正在尝试使用Power Point为较亲切的孩子做一个教育性的交互式演示,并且正在尝试一种测试/活动,其中孩子们必须根据问题单击一些图片。 Some will be right, some don't. 有些会是正确的,有些则不会。 (for instance: can you point the tools used by a fireman? and show 4 images of different tools) Using the mousemove event, I can reproduce a sound that says the name of the object, and using the click event I can reproduce another sound to tell the children "wrong" or "right". (例如:您能指出消防员使用的工具吗?并显示4张不同工具的图像)使用mousemove事件,我可以再现声音,该声音说出了对象的名称,而使用click事件,我可以再现另一种声音告诉孩子们“错”或“正确”。 Now, I would like to change the border of the picture they are clicking on (color and or width), but I have no clue how to do it in VBA. 现在,我想更改他们单击的图片的边框(颜色和宽度),但是我不知道如何在VBA中进行操作。 It must be very easy, but I don't know the sintax :-( Any help? Please? Thank you! 它一定很容易,但是我不知道sintax :-(有什么帮助吗?请?谢谢!

You would be surprised but it's not so easy as you expected, of course, when doing smartly with classes and events. 您会感到惊讶,但是当您巧妙地处理类和事件时,这并不像您预期​​的那么容易。

I'll give you simple idea, so if you have time and really need it you could go this way. 我给您一个简单的想法,因此,如果您有时间并且确实需要它,可以采用这种方式。 But there would be some problems- you will have to figure out how could you get starting borders of your shapes. 但是会有一些问题-您将不得不弄清楚如何才能开始绘制形状的边界。

Here is idea how to start. 这是如何开始的想法。

  1. name each of the shape on the slide- select one and run the following instruction in Immediate window in VBA editor, eg.: 在幻灯片上命名每种形状-选择一种形状,然后在VBA编辑器的“即时”窗口中运行以下指令,例如:

     ActiveWindow.Selection.ShapeRange.Name = "Fireman" 
  2. to change the color and line write macro for each shape (this will run only in slideshow view): 更改每种形状的颜色和线条写宏(仅在幻灯片视图中运行):

     Sub FiremanClick() With SlideShowWindows(1).View.Slide.Shapes("Fireman").Line .Weight = 2 .ForeColor.RGB = RGB(255, 0, 0) End With End Sub 
  3. in application right-click fireman shape and associate action with macro you wrote. 在应用程序中,右键单击消防员形状并将动作与您编写的宏关联。

  4. you will need to figure out how to set back standard setting of each shape and when. 您将需要弄清楚如何取消每种形状的标准设置以及何时设置。

由于某些原因,先设置边框形状颜色然后设置权重时会发生某种错误,形状边框颜色在PowerPoint 2010中变成通用的蓝色。

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

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