C# - Visio 中是否有 OnShapeMoved 或 OnShapeDeleted 事件?
我认为标题或问题已经足够清楚了。我看到了一些关于EventSink的东西,但我发现它很难使用。有什么提示吗?
I think the title or the question is clear enough. I saw something about the EventSink, but I found it difficult to use. Any hint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Visio 主互操作程序集 将这些事件公开为 C# 事件,因此您可以简单地用委托挂钩事件。
请参阅这个简单的示例:
如果您尚未下载 Visio SDK 您应该这样做。 SDK 的最新版本包含许多有用的示例,其中包括一个名为“Shape Add\Delete Event”的示例。如果您有 2010 版本,可以通过转到“开始”菜单\程序\Microsoft Office 2010 开发人员资源\Microsoft Visio 2010 SDK\Microsoft Visio 代码示例库来浏览示例。
The Visio Primary Interop Assembly exposes these events as C# events therefore you can simply hook the event with a delegate.
See this simple example:
If you haven't already downloaded the Visio SDK you should do so. Recent versions of the SDK it contains many useful examples include one called "Shape Add\Delete Event". If you have the 2010 version can browse the examples by going to Start Menu\Programs\Microsoft Office 2010 Developer Resources\Microsoft Visio 2010 SDK\Microsoft Visio Code Samples Library.
我相信您必须实现 EvenSink 才能访问“ShapesDeleted”,即
如果您正在寻找事件“BeforeShapeDelete”而不是“after”ShapeDelete,上面的代码将为您提供帮助;)
I believe that you have to implement EvenSink to get access to "ShapesDeleted", i.e.
the code above will help you if you are looking for the event "BeforeShapeDelete" not the "after"ShapeDelete ;)