版權聲明:歡迎評論和轉載,轉載請注明來源。 https://blog.csdn.net/zy332719794/article/details/7469477
UID中value的幾種值以及表示的意思:
{6CA416B1-E160-11D2-9F4E-00C04F6BC78E} IDataLayer
{40A9E885-5533-11d0-98BE-00805F7CED21} IFeatureLayer
{E156D7E5-22AF-11D3-9F99-00C04F6BC78E} IGeoFeatureLayer
{34B2EF81-F4AC-11D1-A245-080009B6F22B} IGraphicsLayer
{5CEAE408-4C0A-437F-9DB3-054D83919850} IFDOGraphicsLayer
{0C22A4C7-DAFD-11D2-9F46-00C04F6BC78E} ICoverageAnnotationLayer
{EDAD6644-1810-11D1-86AE-0000F8751720} IGroupLayer
例:
private bool IsLayerExist(string layerName)
{
UID uid = new UIDClass();
uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}"; // 代表隻擷取矢量圖層
IEnumLayer layers = mapControl.get_Layers(uid, true);
ILayer layer;
while(layer = layers.Next() != null)
{
if (layer.Name == layerName)
{
return true;
}
}
return false;
}