在C# + ArcEngine开发中,判断axMapControl中的图层是什么样的类型,代码如下
if (axMapControl1.LayerCount> 0)
{
for (inti = 0; i < axMapControl1.LayerCount; i++)
{
ILayer pLayer = axMapControl1.get_Layer(i);
if (pLayer is IFeatureLayer)
{
MessageBox.Show("IFeatureLayer name : " +pLayer.Name);
}
else if (pLayer is IRasterLayer)
{
MessageBox.Show("IRasterLayer name : " +pLayer.Name);
}
}
}
更多类型的判断,写法类似。