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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
雷峰网
雷峰网
博客园 - 叶小钗
V
V2EX
博客园 - Franky
博客园_首页
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
S
SegmentFault 最新的问题
B
Blog RSS Feed
博客园 - 【当耐特】
D
Docker
N
Netflix TechBlog - Medium

博客园 - 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位置发生变化我们就可控了。