Of all layers currently existing in a drawing only one can be active at a time. The currently active layer can be obtained from the ActiveLayer property of the NDrawingDocument class. For example:
C# |
Copy Code
|
---|---|
// obtain the document active layer
NLayer activeLayer = document.ActiveLayer;
|
Visual Basic |
Copy Code
|
---|---|
' obtain the document active layer Dim activeLayer As NLayer = document.ActiveLayer |
Drawings can have multiple layers, which are accessible from the Layers property. The active layer for a drawing is specified by the ActiveLayerUniqueId property of the NDrawingDocument class. The following code adds a new layer to a drawing document and makes it the currently active one:
C# |
Copy Code
|
---|---|
// create a new layer and make it the active one NLayer layer = new NLayer(); drawingDocument.Layers.AddChild(layer); drawingDocument.Layers.ActiveLayerUniqueId = layer.UniqueId; |
Visual Basic |
Copy Code
|
---|---|
' create a new layer and make it the active one Dim layer As New NLayer drawingDocument.Layers.AddChild(layer) drawingDocument.Layers.ActiveLayerUniqueId = layer.UniqueId |