惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
J
Java Code Geeks
H
Help Net Security
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
U
Unit 42
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 叶小钗
D
Docker
量子位
P
Proofpoint News Feed
博客园_首页
T
Tailwind CSS Blog
F
Fortinet All Blogs

博客园 - ant-boss

pl/sql转义字符的问题 备份/恢复SQL Server EXP/IMP 命令参数 Programming with the Microsoft Office Visio 2003 ActiveX Control 使用Visio 2003 Drawing Control开发应用(4) 使用Visio 2003 Drawing Control开发应用(3) 使用Visio 2003 Drawing Control开发应用(1) 使用Visio 2003 Drawing Control开发应用(2) Visio 2003 开发入门 软件数字签名 在ASP.NET下用Microsoft Excel进行数据分析与报表 水晶报表常见问题(转载) Access 类型转换函数 My97日期控件 My97 DatePicker Ver 3.0.1 showModalDialog 使用TransactionScope 实现事务管理 datagrid数据导出到excel文件给客户端下载的几种方法 VSS(Visual SourceSafe)使用入门 [转] 使用asp.net 2.0和SQL SERVER 2005构建多层应用
使用Visio 2003 Drawing Control开发应用(5)
ant-boss · 2007-10-25 · via 博客园 - ant-boss

Visio的DrawingControl暴露出来很多事件,一般来说是够用了。可是有时候,我们还觉得这些事件不够用,比如说:
我们想在拖动某个形状时触发事件来处理,可是直接从drawingcontrol里面是没有这样的事件的,查了查也没有这样的事件。
于是,我可以这样做。
   Visio.Shape shape = this.axDrawingControl1.Window.Application.ActivePage.Shapes[1];
   shape.TextChanged +=new Microsoft.Office.Interop.Visio.EShape_TextChangedEventHandler(shape_TextChanged);
   shape.CellChanged +=new Microsoft.Office.Interop.Visio.EShape_CellChangedEventHandler(shape_CellChanged);

当然真正应用的时候,这个shape不能像我上面那样取,这里注册了两个事件,一个是该Shape的文本发生改变的事件,一个是Cell改变的事件,在事件处理中
  private void shape_CellChanged(Microsoft.Office.Interop.Visio.Cell Cell)
  {
   if(Cell.Name == "PinX" || Cell.Name == "PinY")
    MessageBox.Show("LocationChanged");
  }
这样,该Shape位置发生变化我们就可控了。