Visio Drawing Control控件使用
Visio开发必备
Visio SDK 2007
VisSDK.chm
Visio Code Samples Library.chm
Visio文档操作
查看ShapeSheet属性及帮助内容
宏的录制
Visio的几个重要对象
1、Application
2、Window (Application.ActiveWindow)
3、Document (Application.ActiveDocument)
4、Master、Shape
|
图1 |
Visio XML格式文件分析
Master格式
|
图2 |
Pages/Shapes格式
|
图3 |
图纸的XML文档中,Master后面的Shapes集合中只有一个Shape对象。图纸的Shapes集合有多个对象,每个对象的NameU和Name值可能不一样,一般使用NameU。
Visio基本操作的实现
VisApplication = this.ctrlDrawing.Document.Application; VisWindow = VisApplication.ActiveWindow; VisDocument = VisApplication.ActiveDocument;
//Settings VisApplication.Settings.ShowShapeSearchPane = false; //显示搜索形状窗体 VisApplication.Settings.EnableAutoConnect = false; //自动链接(2007默认) VisApplication.Settings.StencilBackgroundColor = 10070188; //vbGrayText
//文档各种显示 VisApplication.DoCmd((short)VisUICmds.visCmdViewRulers); VisApplication.DoCmd((short)VisUICmds.visCmdViewGrid); VisApplication.DoCmd((short)VisUICmds.ShowGuides); VisApplication.DoCmd((short)VisUICmds.ShowConnectPoints); VisApplication.DoCmd((short)VisUICmds.ShowPageBreaks);
//各种窗口 VisApplication.DoCmd((short)VisUICmds.visCmdShapesWindow); VisApplication.DoCmd((short)VisUICmds.visCmdPanZoom); VisApplication.DoCmd((short)VisUICmds.visCmdCustProp); VisApplication.DoCmd((short)VisUICmds.visCmdSizePos);
SendKeys.Send("^(x)"); //VisApplication.DoCmd((short)VisUICmds.visCmdUFEditCut); SendKeys.Send("{DELETE}"); //VisApplication.DoCmd((short)VisUICmds.visCmdUFEditClear); SendKeys.Send("^+(p)"); //VisApplication.DoCmd(VisUICmds.visCmdFormatPainter); SendKeys.Send("^(z)"); //VisApplication.DoCmd(VisUICmds.visCmdEditUndo);
|