UID 名から ICommand を取得

 2016/9/1 (木)    

using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Framework;
 
public static ICommand GetCommandByName(string UIDName)
{
    IUID pUID = new UIDClass();
    pUID.Value = UIDName; // ex:"EsriJapan_SupportTool_ReferenceID"
    ICommandItem pCommandItem = ((IDocument)ArcMap.Document).CommandBars.Find(pUID);
    return pCommandItem.Command;
}

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.