CAD delete dimension style on operations (com interfaces c # language)

Before deleting dimension style, best judge there is not marked on the map objects are using that style, if any, do not delete the text style

c # code as follows:

private void DelDimStyle()
{
    string txt = textBox2.Text;
    Database MxDrawDatabase = (MxDrawDatabase) axMxDrawX1.GetDatabase ();
     // returns the style sheet object database 
    IMxDrawDimStyleTable DimStyleTable = database.GetDimStyleTable ();
     // get the exemplar pattern style object 
    IMxDrawDimStyleTableRecord DimStyleRec = DimStyleTable.GetAt (TXT, to false );
     IF (DimStyleRec == null )
         return ;
     // delete the object 
    DimStyleRec.Erase ();
    MessageBox.Show ( " successfully deleted dimension style " );
}

Show results:

deldim.png

deldim1.png

Guess you like

Origin www.cnblogs.com/yzy0224/p/12021249.html