visio画图,当极致放大或者缩小页面后,画自定义模具,shape报错

baidu_34322223 2020-07-02 02:10:58

``` 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里面的属性方法各种异常
...全文
136 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧