具有一个图形表示的所有数据库对象的基类,包括了显示实体的通用属性操作,如线型,图层,文字样式,颜色 支持扩展属性"transparency", 类型为: Long
[ object, uuid(0FF37334-4356-4A2F-B70E-06EFDF62AE94), dual, nonextensible, helpstring("IMxDrawEntity interface"), pointer_default(unique) ] interface IMxDrawEntity : IMxDrawMcDbObject;
MxDrawEntity.idl
例如:C#中设置对象总是显示线重
MxDrawResbuf param = new MxDrawResbuf();
param.AddLong(1);
hatch.SetProp("isAlwaysShowLineWeight", param);
例如:C#中设置填充的透明度
MxDrawResbuf tran = new MxDrawResbuf();
tran.AddLong(150);
hatch.SetProp("transparency", tran);
例如:C#中得到填充的透明度
MxDrawResbuf retT = hatch.GetProp("transparency"); MessageBox.Show(retT.AtLong(0).ToString());
例如:支持反删除实体,如下反删除实体.
btr.SetProp("unErase", null);
例如: 支持扩展属性"drawOrder",类型为: Long
MxDrawText text = new MxDrawText(); text.TextString = "dddd"; text.Height = 20; MxDrawResbuf order = new MxDrawResbuf(); order.AddLong(2147403647); text.SetProp("drawOrder", order); axMxDrawX1.DrawEntity(text); axMxDrawX1.PathMoveTo(0, 0); axMxDrawX1.PathLineTo(100, 100); axMxDrawX1.PathLineTo(100, 0); axMxDrawX1.DrawPathToHatch(1.0); axMxDrawX1.ZoomAll();
例如:例如,绘制一个实体,把它放在最下面
MxDrawDatabase database = (MxDrawDatabase)axMxDrawX1.GetDatabase(); MxDrawResbuf ret= database.GetProp("getMinDrawOrder"); long lMin = ret.AtLong(0); MxDrawResbuf ret2 = database.GetProp("getMaxDrawOrder"); long lMax = ret2.AtLong(0); MxDrawEntity ent = (MxDrawEntity)axMxDrawX1.ObjectIdToObject(axMxDrawX1.DrawImage(0, 0, 1, 0, "H:\111.jpg") ); MxDrawResbuf res = new MxDrawResbuf(); res.AddLong((Int32)(lMin - 1)); ent.SetProp("drawOrder",res); axMxDrawX1.ZoomAll();
例如:支持直接在内存中打碎实体,并不增加到数据库中.ExplodeEx,返回打碎后的实体指针.
MxDrawEntity ent = (MxDrawEntity)axMxDrawX1.GetEntity("select entity:"); if (ent == null) return; MxDrawResbuf ret = ent.GetProp("ExplodeEx"); for(int i = 0; i < ret.Count;i++) { MxDrawMcDbObject obj = ret.AtObject(i); if(obj == null) continue; axMxDrawX1.DrawEntity(obj); }
例如:创建扩展字典,并写入数据.
// 写扩展字典 MxDrawResbuf param = new MxDrawResbuf(); //创建扩展字典,如果对象已经有扩展字典,该函数什么都不做。 ent.SetProp("createExtensionDictionary", param); // 得到扩展字典 MxDrawDictionary dict = ent.GetExtensionDictionary(); if (dict == null) return; // 向扩展字典中增加一个自己的字典,用于写自己的数据. MxDrawDictionary myDict = (MxDrawDictionary)dict.AddObject("MyDict", "McDbDictionary"); // 向字典中增加一个扩展记录。 MxDrawXRecord xRecord = (MxDrawXRecord)myDict.AddXRecord("MyGlobalData"); if (xRecord == null) return; // 做准备写入的扩展记录数据. MxDrawResbuf xData2 = new MxDrawResbuf(); xData2.AddLong(99999); xData2.AddDouble(666); MxDrawPoint ptTest = new MxDrawPoint(); ptTest.x = 77; ptTest.y = -100; xData2.AddPoint(ptTest); xData2.AddString("TestApp2"); // 写入数据. xRecord.SetXRecordData(xData2);