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

推荐订阅源

V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
S
SegmentFault 最新的问题
D
Docker
博客园 - 司徒正美
雷峰网
雷峰网
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - Franky
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
MongoDB | Blog
MongoDB | Blog

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