CAD关于删除标注样式操作(com接口c#语言)

在删除标注样式前,最好判断图上有没有标注对象正在使用该样式,如果有的话就不要删除文字样式

c#代码如下:

private void DelDimStyle()
{
    string txt = textBox2.Text;
    MxDrawDatabase database = (MxDrawDatabase)axMxDrawX1.GetDatabase();
    //返回数据库中的样式表对象
    IMxDrawDimStyleTable DimStyleTable = database.GetDimStyleTable();
    //得到样式表表中的样式对象
    IMxDrawDimStyleTableRecord DimStyleRec = DimStyleTable.GetAt(txt, false);
    if (DimStyleRec == null)
        return;
    //删除对象
    DimStyleRec.Erase();
    MessageBox.Show("成功删除标注样式");
}

效果展示:

deldim.png

deldim1.png

posted on 2019-12-11 11:03  梦想CAD控件  阅读(347)  评论(0)    收藏  举报

导航