static public void Foo() { Document document = Application.DocumentManager.MdiActiveDocument; Database database = document.Database; Autodesk.AutoCAD.DatabaseServices.TransactionManager transactionManager = database.TransactionManager; using (Transaction transaction = transactionManager.StartTransaction()) { document.Editor.WriteMessage("HOORAY\n"); BlockTable blockTable = (BlockTable)transactionManager.GetObject(database.BlockTableId, OpenMode.ForRead, openErased: false); BlockTableRecord blockTableRecord = (BlockTableRecord)transactionManager.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false); foreach (Autodesk.AutoCAD.DatabaseServices.ObjectId objectId in blockTableRecord) { DBObject dbObject = objectId.GetObject(OpenMode.ForRead); document.Editor.WriteMessage("type: " + dbObject.GetType() + "\n"); if (dbObject.GetType() == typeof(MLeader)) { document.Editor.WriteMessage("We found a multileader.\n"); MLeader mLeader = (MLeader)dbObject; // damn: the .net api does not expose the functions related to mleader style overrides. //mLeader.isoverride(MLeader.PropertyOverrideType.kLeaderLineType); //MLeader.setOverride(MLeader.PropertyOverrideType.kLeaderLineType, false); //kLeaderLineType //ErrorStatus result = setOverride(mLeader.UnmanagedObject, 16, false); bool result = isOverride(mLeader.UnmanagedObject, 16); document.Editor.WriteMessage("result: " + result + "\n"); } } } }
/// <summary> /// Deletes the record related to the object from the Database /// </summary> /// <param name="dbobject">The object to be deleted</param> public override void Delete(DBObject dbobject) { string sqlcmd = "DELETE FROM " + dbobject.GetType().Name + " WHERE "; dbobject.GetType().GetProperties().AsParallel().Where(x => WhereNotNull(x, dbobject)).ForAll(x => sqlcmd += x.Name + " = '" + x.GetValue(dbobject, null) + "' AND "); sqlcmd = sqlcmd.Substring(0, sqlcmd.Length - " AND ".Length); }
public override void Update(DBObject dbobject) { string sqlcmd = "UPDATE " + dbobject.GetType().Name + " SET "; ParallelQuery <PropertyInfo> pinfo = dbobject.GetType().GetProperties().AsParallel().Where(x => WhereNotNull(x, dbobject)); pinfo.ForAll(x => sqlcmd += x.Name + " = " + x.GetValue(dbobject, null) + ", "); sqlcmd = sqlcmd.Substring(0, sqlcmd.Length - ", ".Length) + " WHERE "; pinfo.ForAll(x => sqlcmd += x.Name + " = " + x.GetValue(dbobject, null) + " AND "); sqlcmd = sqlcmd.Substring(0, sqlcmd.Length - " AND ".Length); }
public static void AddDBObject(DBObject obj) { Hashtable tmp = (Hashtable)m_dbobjects[obj.GetType()]; if (tmp == null) { tmp = new Hashtable(); m_dbobjects[obj.GetType()] = tmp; } tmp[obj.ObjectId] = obj; }
public static void CopyObjectProperties(DBObject From, DBObject To) { if (From != null && To != null) { foreach (System.Reflection.PropertyInfo propInfo in From.GetType().GetProperties()) { string propertyName = propInfo.Name; System.Reflection.PropertyInfo destinationPropInfo = To.GetType().GetProperty(propertyName); if (destinationPropInfo != null) { if (destinationPropInfo.CanWrite) { if (From is ImportDBObject) { if (!((ImportDBObject)From).isImportModified(propertyName)) { continue; } } object value = propInfo.GetValue(From, null); destinationPropInfo.SetValue(To, value, null); } else { continue; } } } } }
private void CloneModelSpaceDataFromSourceToTarget(Database SourceDB, Database TargetDB) { using (Transaction SourceTran = SourceDB.TransactionManager.StartTransaction()) { BlockTableRecord SourceModelSpace = (BlockTableRecord)SymbolUtilityServices.GetBlockModelSpaceId(SourceDB).GetObject(OpenMode.ForRead); BlockTable SourceBlockTable = SourceTran.GetObject(SourceDB.BlockTableId, OpenMode.ForRead) as BlockTable; using (Transaction TargetTran = TargetDB.TransactionManager.StartTransaction()) { BlockTable TargetBlockTable = TargetTran.GetObject(TargetDB.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord TargetModelSpace = (BlockTableRecord)SymbolUtilityServices.GetBlockModelSpaceId(TargetDB).GetObject(OpenMode.ForRead); foreach (ObjectId item in SourceModelSpace) { DBObject Rec = SourceTran.GetObject(item, OpenMode.ForRead); System.Diagnostics.Debug.WriteLine(Rec.GetType()); Entity Ent = Rec as Entity; if (Ent != null) { if (!TargetBlockTable.Has(Ent.BlockName)) { TargetModelSpace.AppendEntity(Ent); TargetTran.AddNewlyCreatedDBObject(Rec, true); } } } TargetTran.Commit(); } } }
public void ShowType() { Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument; PromptEntityResult entity = mdiActiveDocument.Editor.GetEntity("\nSelect entity: "); if (entity.Status == 5100) { using (Transaction transaction = mdiActiveDocument.TransactionManager.StartTransaction()) { DBObject @object = transaction.GetObject(entity.ObjectId, 0); Type type = @object.GetType(); mdiActiveDocument.Editor.WriteMessage(string.Format("\nType: '{0}'", type.ToString())); mdiActiveDocument.Editor.WriteMessage(string.Format("\nIsPublic: '{0}'", type.IsPublic)); mdiActiveDocument.Editor.WriteMessage(string.Format("\nAssembly: '{0}'\n", type.Assembly.FullName)); mdiActiveDocument.Editor.WriteMessage(new string('*', 30)); mdiActiveDocument.Editor.WriteMessage("\n"); PropertyInfo[] properties = type.GetProperties(); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (PropertyInfo propertyInfo in properties) { object obj; try { obj = RuntimeHelpers.GetObjectValue(propertyInfo.GetValue(@object, null)); } catch (Exception ex) { obj = string.Format("Exception: '{0}'", ex.Message); } dictionary.Add(string.Format("{0} [{1}]", propertyInfo.Name, propertyInfo.PropertyType), RuntimeHelpers.GetObjectValue(obj)); mdiActiveDocument.Editor.WriteMessage(string.Format("\n\tProperty: '{0}';\tType: '{1}';\tValue.ToString: '{2}'", propertyInfo.Name, propertyInfo.PropertyType, RuntimeHelpers.GetObjectValue(obj))); } } } }
public void MyLispFunction() { Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument; PromptEntityResult entity = mdiActiveDocument.Editor.GetEntity("\nSelect entity: "); Document mdiActiveDocument2 = Application.DocumentManager.MdiActiveDocument; Editor editor = mdiActiveDocument2.Editor; Database database = mdiActiveDocument2.Database; Transaction transaction = database.TransactionManager.StartTransaction(); using (transaction) { try { DBObject @object = entity.ObjectId.GetObject(0); foreach (MemberInfo memberInfo in @object.GetType().GetMembers()) { editor.WriteMessage("\n" + memberInfo.Name.ToString()); } transaction.Commit(); } catch (Exception ex) { throw; } } }
/// <summary> /// Метод через Reflection копирует значения свойств с аналогичными именами и типами /// </summary> /// <param name="o">Текущий объект</param> /// <param name="source">Объект-источник, откуда копируются значения свойств. Может быть другого типа, чем o</param> public static void CopyPropertiesFrom(this DBObject o, DBObject source) { PropertyInfo[] sourceProps = source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); PropertyInfo[] thisProps = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo sourcePI in sourceProps) { PropertyInfo thisPI = thisProps.FirstOrDefault(p => p.Name == sourcePI.Name && p.PropertyType == sourcePI.PropertyType && p.CanRead && p.CanWrite); if (sourcePI.CanRead && sourcePI.CanWrite && sourcePI.PropertyType.Name != "Point3d" && thisPI != null) { try { thisPI.SetValue(o, sourcePI.GetValue(source, null), null); } catch (System.Reflection.TargetInvocationException ex) { Debug.WriteLine(ex.InnerException.Message); } } } }
public static void ViewXData() { while (true) { ObjectId id = Interaction.GetEntity("\n选择实体"); if (id == ObjectId.Null) { break; } DBObject obj = id.QOpenForRead(); using (System.IO.StringWriter sw = new System.IO.StringWriter()) { sw.WriteLine(RXClass.GetClass(obj.GetType()).DxfName); var xdata = obj.XData; if (xdata != null) { TypedValue[] data = obj.XData.AsArray(); foreach (TypedValue value in data) { sw.WriteLine(value.ToString()); } } else { sw.WriteLine("无扩展数据。"); } Gui.TextReport("XData", sw.ToString(), 300, 300, true); //CppImport.RunCommand(false, "textscr"); } } }
public void GetDBChanges() { if (DBObject is null) { DBObject = (DBModel)Activator.CreateInstance(GetType()); } foreach (PropertyInfo prop in DBObject.GetType().GetProperties()) { object[] notMapped = prop.GetCustomAttributes(typeof(NotMapped), true); if (notMapped.Length == 0 && (GetPropValue(DBObject, prop.Name)?.ToString() ?? "") != (GetPropValue(this, prop.Name)?.ToString() ?? "")) { DBChanges.Add(new DBChange { Field = prop.Name, FromValue = GetPropValue(DBObject, prop.Name).ToString(), ToValue = GetPropValue(this, prop.Name).ToString() }); FieldsChanged.Add(prop.Name); } } }
ObjToTypeAndHandleStr(DBObject dbObj) { Debug.Assert(dbObj != null); string str1 = dbObj.GetType().Name; return(string.Format("< {0,-20} {1,4} >", str1, dbObj.Handle.ToString())); }
/// <summary> /// Extract attributes from BlockReference. /// </summary> /// <param name="bref">BlockReference for data extraction</param> /// <param name="innerBlocks"> /// List of BlockReferences incapsulated in bref. /// Can be used by upper-level code for recursively walking throw bref.</param> /// <returns></returns> public static Record GetContent(BlockReference bref, List <BlockReference> innerBlocks = null) { Record res = new Record(); using (Transaction tr = activeDB.TransactionManager.StartTransaction()) { ObjectId btrId = bref.BlockTableRecord; BlockTableRecord rec = tr.GetObject(btrId, OpenMode.ForRead) as BlockTableRecord; AttributeCollection attCol; foreach (ObjectId id in rec) { DBObject ob = tr.GetObject(id, OpenMode.ForRead); Type obTp = ob.GetType(); if (obTp == typeof(AttributeDefinition)) { AttributeDefinition adef = (AttributeDefinition)ob; if (/*adef.Tag.ToLower() != "qty" && */ adef.TextString != "") { res[adef.Tag] = adef.TextString; } else { res[adef.Tag] = Record.Default(adef.Tag); } } if (obTp == typeof(BlockReference) && innerBlocks != null) { innerBlocks.Add((BlockReference)ob); } } attCol = bref.AttributeCollection; foreach (ObjectId id in attCol) { AttributeReference aref = tr.GetObject(id, OpenMode.ForRead) as AttributeReference; if (aref.TextString != "") { res[aref.Tag] = aref.TextString; } else { res[aref.Tag] = Record.Default(aref.Tag); } } } res["block_name"] = bref.Name; if (res["header"] == "элементы конструкции") { if (!res["block_name"].StringValue.StartsWith("$")) { res["dim"] = GetBoundingBox(bref); } else { } } return(res.Update()); }
private void SendDBObject(DBObject obj) { WorldPacket pkg = new WorldPacket(WORLDMSG.DESERIALIZE_OBJ); pkg.Write(obj.GetType().ToString()); pkg.Write(obj.ObjectId); obj.Serialize(pkg); Send(pkg); }
internal static void RemoveDBObject(DBObject obj) { Hashtable tmp = (Hashtable)m_dbobjects[obj.GetType()]; if (tmp != null) { tmp.Remove(obj.ObjectId); } }
public static void SaveDBObject(DBObject obj) { if (obj.Dirty == false) { return; } if (obj.PendingCreate) { obj.PendingSave = true; return; } Console.WriteLine(obj.GetType().ToString()); WorldPacket pkg = new WorldPacket(WORLDMSG.DESERIALIZE_OBJ); pkg.Write(obj.GetType().ToString()); pkg.Write(obj.ObjectId); obj.Serialize(pkg); WorldServer.Send(pkg); obj.Dirty = false; }
/// <summary> /// Saves the object as a new record /// </summary> /// <param name="dbobject">The object to be saved</param> public override void Insert(DBObject dbobject) { string names = "(", values = "("; string sqlcmd = "INSERT INTO " + dbobject.GetType().Name; List <PropertyInfo> pinfo = dbobject.GetType().GetProperties().AsParallel(). Where(x => WhereNotNull(x, dbobject)).ToList(); foreach (var item in pinfo) { names += item.Name + ", "; values += "'" + item.GetValue(dbobject, null) + "', "; } names = names.Substring(0, names.Length - ", ".Length) + ")"; values = values.Substring(0, values.Length - ", ".Length) + ")"; sqlcmd += names + " VALUES " + values; SqlCommand cmd = new SqlCommand(sqlcmd, connection_); cmd.ExecuteNonQuery(); }
/// <summary> /// /// </summary> /// <param name="ed"></param> /// <param name="tran"></param> /// <param name="pso"></param> /// <param name="showMultiple">是否一次显示选择的多个对象</param> /// <returns></returns> private static bool GetShow(Editor ed, Transaction tran, PromptSelectionOptions pso, bool showMultiple) { // Finally run the selection and show any results PromptSelectionResult psr = ed.GetSelection(pso); if (psr.Status == PromptStatus.OK) { var ids = psr.Value.GetObjectIds(); string msg; if (ids.Length > 0) { ed.WriteMessage("------------- 选择结果 -------------------\r\n"); if (!showMultiple) { var id = ids[0]; DBObject obj = tran.GetObject(id, OpenMode.ForRead); msg = $"DxfName: {id.ObjectClass.DxfName}; " + $"\r\nClassName:{id.ObjectClass.Name};" + $"\r\nObjectType: {obj.GetType().FullName}\r\n"; // // MessageBox.Show(msg); ed.WriteMessage(msg); if (obj is Curve) { var c = obj as Curve; ed.WriteMessage("\ncorresponding geometric object: " + c.GetGeCurve().GetType().FullName); ed.WriteMessage($"\nstart:{c.StartParam}-{c.StartPoint};\t end:{c.EndParam}-{c.EndPoint}"); } } else { foreach (var id in ids) { DBObject obj = tran.GetObject(id, OpenMode.ForRead); msg = $"\r\nDxfName: {id.ObjectClass.DxfName}; " + $"\r\nClassName:{id.ObjectClass.Name};" + $"\r\nObjectType: {obj.GetType().FullName}\r\n----------\r\n"; // // MessageBox.Show(msg); ed.WriteMessage(msg); } } } return(true); } else { return(false); } }
/// <summary> /// Load an object from the database, where the objects' values are checked against any record in the table. /// Throws an RecordNotFoundException when no record is found. /// Always returns the first result. /// </summary> /// <param name="dbobject"></param> /// <returns></returns> public override List <DBObject> Get(DBObject dbobject) { Type t = dbobject.GetType(); List <DBObject> result = new List <DBObject>(); string sqlcmd = "Select * From " + dbobject.GetType().Name + " WHERE "; dbobject.GetType().GetProperties().AsParallel().Where(x => WhereNotNull(x, dbobject)).ForAll(x => sqlcmd += x.Name + " = '" + x.GetValue(dbobject, null) + "' AND "); sqlcmd = sqlcmd.Substring(0, sqlcmd.Length - " AND ".Length); Debugger.Break(); SqlCommand cmd = new SqlCommand(sqlcmd, connection_); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DBObject obj = (DBObject)Activator.CreateInstance(t); obj.GetType().GetProperties().ToList().ForEach(x => x.SetValue(dbobject, reader[x.Name], null)); result.Add(obj); } return(result); }
public static void DeleteDBObject(DBObject obj) { if (obj.PendingCreate) { obj.PendingDelete = true; return; } RemoveDBObject(obj); WorldPacket pkg = new WorldPacket(WORLDMSG.DELETE_DBOBJECT); pkg.Write(obj.GetType().ToString()); pkg.Write(obj.ObjectId); WorldServer.Send(pkg); }
ProcessObjects() { ObjectIdCollection objIds = new ObjectIdCollection(); ArrayList names = new ArrayList(); // get all the symbol table objects GetSymbolTableEntries(m_db.BlockTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.DimStyleTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.LayerTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.LinetypeTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.RegAppTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.TextStyleTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.ViewTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.ViewportTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.UcsTableId, ref objIds, ref names); // get all the NamedObjectDictionary objects GetRecursiveDictionaryEntries(m_db.NamedObjectsDictionaryId, ref objIds, ref names); // get all the Extension dictionary objects foreach (ObjectId extDictId in m_extDictIds) { GetRecursiveDictionaryEntries(extDictId, ref objIds, ref names); } int len = objIds.Count; // get reference count to these objects int[] countArray = new int[len]; for (int i = 0; i < len; i++) { countArray[i] = 0; // init count values; } m_db.CountHardReferences(objIds, countArray); SymbolCount tmpCount = null; for (int i = 0; i < len; i++) { DBObject tmpObj = m_trHlp.Transaction.GetObject(objIds[i], OpenMode.ForRead); tmpCount = GetObjectNode(GetObjClassName(tmpObj), tmpObj.GetType().Name, true); if (tmpCount != null) { tmpCount.m_count++; tmpCount.m_symbolNames.Add(names[i]); tmpCount.m_references.Add(countArray[i]); } } }
public static void CreateDBObject(DBObject obj) { if (obj.PendingCreate) { return; } obj.PendingCreate = true; int id = currentRequestID++; createDBRequests[id] = obj; WorldPacket pkg = new WorldPacket(WORLDMSG.CREATE_DBOBJECT); pkg.Write(id); pkg.Write(obj.GetType().ToString()); WorldServer.Send(pkg); }
bool Check(ObjectId checkObj) { DBObject thisObj = checkObj.GetObject(OpenMode.ForRead, false); ObjectId thisSpace = thisObj.OwnerId; PropertyInfo checkVal; if ((checkVal = thisObj.GetType().GetProperty(property)).Equals(rule)) { return(false); } if (checkVal.Equals(null)) { return(false); } return(true); }
// in a separate method to make it easier to switch back to .NET 3.5---removing "dynamic" static string GetLinearUnitString(DBObject aecvarsDwgSetup) { // We don't want to add a reference to the AEC assembly, so use reflection via "dynamic" // to get the "LinearUnit" property Type t = aecvarsDwgSetup.GetType(); object oUnit = t.InvokeMember(/*MSG0*/ "LinearUnit", BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Public, null /*binder*/, aecvarsDwgSetup, null /*args*/, // TODO: use "dynamic" in .NET 4.0 System.Globalization.CultureInfo.InvariantCulture); var unit = (Enum)oUnit; //Enum unit = ((dynamic)aecvarsDwgSetup).LinearUnit; if (unit.GetType().FullName != /*MSG0*/ "Autodesk.Aec.BuiltInUnit") { throw new InvalidOperationException(); // yikes! the "enum" is of the wrong type; something got changed on us? } return(unit.ToString()); }
private static bool IsVisibleLinearEntity(DBObject entity, Transaction transaction) { var type = entity.GetType(); if (type != typeof(Polyline) && type != typeof(Line)) { return(false); } var layer = (LayerTableRecord)transaction.GetObject(((Entity)entity).LayerId, OpenMode.ForRead); if (layer.IsOff || layer.IsFrozen) { return(false); } return(true); }
public static List <ObjectId> GetMultipleElementId(Document document, string message, params Type[] elementTypes) { var objectIds = new List <ObjectId>(); Editor editor = document.Editor; Database database = document.Database; var peo = new PromptEntityOptions(message); peo.AllowNone = true; using (Transaction transaction = database.TransactionManager.StartTransaction()) { while (true) { PromptEntityResult psr = editor.GetEntity(peo); if (psr == null || objectIds.Contains(psr.ObjectId)) { continue; } if (psr.Status == PromptStatus.Cancel) { return(null); } if (psr.Status == PromptStatus.OK) { DBObject obj = transaction.GetObject(psr.ObjectId, OpenMode.ForRead); if (elementTypes == null || elementTypes.Any(elementType => obj.GetType() == elementType)) { objectIds.Add(psr.ObjectId); continue; } } if (psr.Status == PromptStatus.None) { break; } } } return(objectIds); }
public static void writeObject(System.IO.StreamWriter file, DBObject dbo, int id) { if (dbo is Circle) { Circle circle = dbo as Circle; writeCircle(file, circle); } else if (dbo is Arc) { Arc arc = dbo as Arc; writeArc(file, arc); } else if (dbo is Line) { Line line = dbo as Line; writeLine(file, line); } else if (dbo is MText) { MText text = dbo as MText; writeText(file, text); } else if (dbo is DBText) { DBText text = dbo as DBText; writeDBText(file, text); } else if (dbo is Polyline) { Polyline pline = dbo as Polyline; writePolyline(file, pline); } else { file.WriteLine("__type not processed: " + dbo.GetType()); } file.WriteLine("ID: " + id); file.WriteLine("END_OBJ"); }
/// <summary> /// Копирование свойств с помощью рефлексии /// https://spiderinnet1.typepad.com/blog/2012/03/autocad-net-copy-properties-between-different-kind-entity.html /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void BetweenDifferentKind(DBObject source, DBObject target) { //if (source.GetType() == target.GetType()) // throw new ArgumentException("The same kind!"); PropertyInfo[] piArr = source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); PropertyInfo[] piArr1 = target.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo pi in piArr) { PropertyInfo pi1 = piArr1.FirstOrDefault(p => p.Name == pi.Name && p.PropertyType == pi.PropertyType && p.CanRead && p.CanWrite); if (pi.CanRead && pi.CanWrite && pi.PropertyType.Name != "Point3d" && pi1 != null) { try { pi1.SetValue(target, pi.GetValue(source, null), null); } catch (System.Reflection.TargetInvocationException tiEx) { } } } }
private ObjectIdCollection TypeCheckApproach2() { ObjectIdCollection ids = new ObjectIdCollection(); Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord; foreach (ObjectId id in btr) { DBObject obj = tr.GetObject(id, OpenMode.ForRead); if (obj.GetType() == typeof(Circle)) { ids.Add(obj.Id); } } tr.Commit(); } return(ids); }
PopulateCompareBox(object compareBox, ObjectId objId, string name) { DBObject tempObj = m_trHlpr.Transaction.GetObject(objId, OpenMode.ForRead); String type = String.Format("Type : {0}", tempObj.GetType().Name); String id = String.Format("ObjectId : {0}", objId.ToString()); if (compareBox == m_compareBx1) { m_compareBx1.Items.Clear(); m_compareBx1.Items.Add(name); m_compareBx1.Items.Add(type); m_compareBx1.Items.Add(id); } if (compareBox == m_compareBx2) { m_compareBx2.Items.Clear(); m_compareBx2.Items.Add(name); m_compareBx2.Items.Add(type); m_compareBx2.Items.Add(id); } }