The answer is to use the ToolFilter and the addMapToolsProperties.InsertionLayerFilter() function.
See the code below.
AddMapToolProperties addMapToolProperties = mapControl1.Tools.AddMapToolProperties as AddMapToolProperties;
ToolFilter toolFilter = (ToolFilter)addMapToolProperties.InsertionLayerFilter;
if (toolFilter != null && !toolFilter.IncludeLayer(myLayer2.MapLayer))
{
toolFilter.SetExplicitInclude(myLayer2.MapLayer, true);
}
After which, use the new "addMapToolProperties" when you create your AddMapTool.
No comments:
Post a Comment