增加新的图层
[id(47), helpstring("method AddLayer")] LONGLONG AddLayer(BSTR pszName);
参数 |
说明 |
BSTR pszName |
图层名 |
返回新加入的图层id
例如: 增加一个层,并设置它的颜色为红色,C#代码
Int32 id = axMxDrawX1.AddLayer("MyLayerName"); MxDrawDatabase database = (MxDrawDatabase)axMxDrawX1.GetDatabase(); MxDrawLayerTableRecord newLayer = (MxDrawLayerTableRecord)database.ObjectIdToObject(id); MxDrawMcCmColor color = new MxDrawMcCmColor(); color.SetRGB(255,0,0); newLayer.Color = color;
例如: JS代码,建一个图,并改变颜色.
var MxDrawXCtrl = document.getElementById("MxDrawXCtrl1") var layerId = MxDrawXCtrl.AddLayer("断面图"); var database = MxDrawXCtrl.GetDatabase(); var layer = database.ObjectIdToObject(layerId); //layer.Color.SetRGB(255,0,0); var newColor = layer.Color; newColor.SetRGB(255,0,0); layer.Color = newColor; MxDrawXCtrl.LayerName = "断面图"; MxDrawXCtrl.DrawCADColorIndex = 256; MxDrawXCtrl.DrawText(0,0,"文字内容字符串",8.0,0.0,1,3);