使用代码/脚本/定义在 PowerPoint 中创建自定义形状或连接器
PowerPoint 2007 中的形状似乎是内置的 - 有没有办法创建“用户”/“自定义”形状?
我想创建一个自定义连接器,但知道是否可以创建自定义形状在将来可能会很方便。
The shapes in in PowerPoint 2007 seem to be built in - is there a way to create 'user'/'custom' shapes?
I wanted to create a custom connector, but knowing if you can create a custom shape, could be handy in the future.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有多种方法可以做到这一点,但不确定它们是否能满足您的需求。 如果您需要将自定义形状添加到“插入形状”下拉列表中,然后使用鼠标光标放置并调整大小,那么我知道没有办法做到这一点。
但是,如果您想定义自定义形状,然后以编程方式将其添加到演示文稿中的某个位置,那么这肯定是可行的。 在 VBA 和 VSTO 中,这可以通过对象模型来完成; 您可以添加自由形状、折线、曲线等,并且在某些情况下将它们分组以形成单个形状。 我已经用一系列我经常需要的九角星做了同样多的事情。
在 Drawing ML 中创建自定义形状/连接器似乎也是可能的。 我还没有尝试过,但看起来确实可以做到。 为此您需要进行许多计算,这些计算在 Ecma 规范中有详细记录。 我所说的“有据可查”并不是指“简单”——所有的公式都可能很复杂。 就连接器而言,您似乎需要以编程方式更改连接器连接到的形状,尽管它们是自定义连接器(形状标识其连接器,如果有的话)。
There are several ways to do this, but not sure if they would meet your needs. If you need to have a custom shape added to the "insert shapes" drop-down and then place and size with your mouse cursor, then I know of no way to do this.
However, if you would like to define a custom shape and then programmatically add this to a location in your presentation, this is doable for sure. In VBA and VSTO, this is can be done via the Object Model; you can add a FreeForm shape, polylines, curves, etc. and in some cases group these to form a single shape. I've done as much with a series of 9-pointed stars that I needed on a regular basis.
To create a custom shape/connector in Drawing ML also appears possible. It is not something I've tried yet, but it certainly looks as if it can be done. There are a number of calculations you would need for this that are well documented in the Ecma specs. By "well documented", I don't mean "easy" though - all of the formulas can be complex. In the case of the connector, it looks as if you would need to programmatically change the shapes your connector is connecting to though to your custom connector (shapes identify their connector, if they have one).