老师您好,我想向IEClass中添加属性,但是之后显示出来的属性顺序和我添加的顺序不一样,我怎么用代码来控制这个显示的顺序呢
这是我添加时的顺序
这是在ord中显示出来的
可以通过下图所示的CustomAttribute来订制这个属性的排序:
老师,可以用代码直接实现不要XML吗,我没有找到这个函数
请参考如下代码:
IECSchema schemaCustomAtt = DgnECManager.Manager.LocateSchemaInScope(scopeTemp, "EditorCustomAttributes", verMaj, verMin, SchemaMatchType.LatestCompatible); if (schemaCustomAtt != null) { IECClass ecClassCate = schemaCustomAtt.GetClass("Category"); IECInstance ecInsCate = ecClassCate.CreateInstance(); ecInsCate.SetString("Name", "NameGhq"); ecInsCate.SetString("DisplayLabel", "Ghq"); ecInsCate.SetInteger("Priority", 200000); ecprop.SetCustomAttribute(ecInsCate); //ecClassCate = schemaCustomAtt.GetClass("DontShowNullProperty"); //ecInsCate = ecClassCate.CreateInstance(); //ecprop.SetCustomAttribute(ecInsCate); //ecprop1.SetCustomAttribute(ecInsCate); }
谢谢老师!