在删除标注样式前,最好判断图上有没有标注对象正在使用该样式,如果有的话就不要删除文字样式
js代码如下:
function DelDim() { var winWidth = 440; var winHeight = 140; var winLeft = (screen.width - winWidth) / 2; var winTop = (screen.height - winHeight) / 2 - 20; var str = 'dialogHeight:' + winHeight + 'px;dialogWidth:' + winWidth + 'px;dialogTop:' + winTop + 'px;dialogLeft:' + winLeft + 'px;resizable:yes;center:yes;status:no;' var rt = window.showModalDialog("Gettext.htm?tmp=" + Math.random(), "输入图层名", str); var txt; if (typeof (rt) == "undefined") { return; } else { var arr = rt.split(","); txt = arr[0]; } var database =mxOcx.GetDatabase(); database.CurrentlyDimstyleName = "Standard"; //返回数据库中的样式表对象 var DimStyleTable = database.GetDimStyleTable(); //得到样式表表中的样式对象 var DimStyleRec = DimStyleTable.GetAt(txt, false); if (DimStyleRec == null) return; //删除对象 DimStyleRec.Erase(); alert("成功删除标注样式"); }
来源:https://www.cnblogs.com/yzy0224/p/12010623.html