visio画图,当极致放大或者缩小页面后,画自定义模具,shape报错
``` Microsoft.Office.Interop.Visio.Document currentStencil = axDrawingControl1.Document.Application.Documents.OpenEx(System.Windows.Forms.Application.StartupPath + "\\Visio模具\\模具.vssx", (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenHidden);
//关闭隐藏“形状搜索”面板(非常重要)
Microsoft.Office.Interop.Visio.Window winShapeSearch = axDrawingControl1.Window.Windows.get_ItemFromID((int)Microsoft.Office.Interop.Visio.VisWinTypes.visWinIDShapeSearch);
winShapeSearch.Close();
Hashtable hashtableType = new Hashtable();
hashtableType = ToolsUtil.GetModelDiagramNodeType(modelDiagramSetConfig);
string strMastersNodeType = (string)hashtableType["19"];
Microsoft.Office.Interop.Visio.Shape shape = currentPage.Drop(currentStencil.Masters[strMastersNodeType], dNodeWidth, dNodeHeight);
if (shape != null && shape.ID > 0)
{
shape.Name = paramHashtable["NewLocalNodeID"].ToString();
shape.Data2 = "19";
shape.Data3 = "局部活动节点";
shape.Text = paramHashtable["NodeName"].ToString() + "!!!";
visioApplication.ActiveWindow.Page.Shapes.ItemFromID(shape.ID).CellsSRC(VisSectionIndices.visSectionCharacter, 0, VisCellIndices.visCharacterColor).FormulaU = "2";
}
```
以下是报错:
CalloutTarget = “((Microsoft.Office.Interop.Visio.ShapeClass)shape).CalloutTarget”引发了类型“System.Runtime.InteropServices.COMException”的异常
Data1 = “((Microsoft.Office.Interop.Visio.ShapeClass)shape).Data1”引发了类型“System.Runtime.InteropServices.COMException”的异常
。。。。。。。。
所有的这些都报错了,整个shape
当运行到 Microsoft.Office.Interop.Visio.Shape shape = currentPage.Drop(currentStencil.Masters[strMastersNodeType], dNodeWidth, dNodeHeight);这句话的时候,shape里面的属性方法各种异常