版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
调用控件AddLayer方法添加图层,详细接口说明见:http://www.mxdraw.com/help/frames.htm?frmname=topic&[email protected]
例如C#代码:
// 新建一个图层
axMxDrawX1.AddLayer("MyLayerName");
// 设置控件Draw函数使得的层
axMxDrawX1.LayerName = "MyLayerName";
或使用层表Add方法来添加一个图层
private void CreateLayer()
{
// sNewLayerName新创建的图层名
string sNewLayerName = "TestNewLayer";
MxDrawApplication app = new MxDrawApplication();
// 得到当前数据为的层表对象
MxDrawLayerTable layerTable = app.WorkingDatabase().GetLayerTable();
// 向层表中新增一个层表记录
MxDrawLayerTableRecord layerTableRec = layerTable.Add(sNewLayerName);
// 设置新图层的颜色。SetRGB
MxDrawMcCmColor color = new MxDrawMcCmColor();
color.SetRGB(255, 0, 0);
layerTableRec.Color = color;
// 把新建的层设置成当前层
app.WorkingDatabase().CurrentlyLayerName = sNewLayerName;
}
文章例子运行效果: