在滑动csharp时单击shape powerpoint时调用函数

时间:2015-12-22 08:42:42

标签: c# powerpoint office-addins

我知道我们可以在滑动时单击形状时添加动作 ActionSettings [PowerPoint.PpMouseActivation.ppMouseClick]。Csharp中的动作 比如下面的代码:

aromaClick = thisSlide.Shapes.AddShape(Office.MsoAutoShapeType.msoShape24pointStar, 10, 10, 20, 20);
Globals.ThisAddIn.aromaClick.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick].Action = PowerPoint.PpActionType.ppActionRunProgram;
 Globals.ThisAddIn.aromaClick.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick].Run = "path-to-file";

但是我想知道在点击形状发生时我是否可以调用函数?可能吗? 比如调用这个函数:

void hello(){
//something
}
谢谢你!

1 个答案:

答案 0 :(得分:0)

问题不明确。是否要在单击形状时指定要运行的宏?如果是这种情况,则代码类似。

Globals.ThisAddIn.aromaClick.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick].Action = PowerPoint.PpActionType.ppActionRunMacro;
Globals.ThisAddIn.aromaClick.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick].Run = "Hello";