Lemmmmmmmo丶 2016-11-08 09:10 采纳率: 0%
浏览 2050

ArcEngine 图层的属性实现问题

public sealed class LayerProperties : BaseCommand
{
    private IApplication m_application;
    private string m_layerCategoryID = string.Empty;

    public LayerProperties()
    {
        base.m_category = ".NET Samples";
        base.m_caption = "Simple Layer Properties... (C#)";
        base.m_message = "Display a simplified layer property sheet";
        base.m_toolTip = "Simplified layer property sheet";
        base.m_name = "CSNETSamples_SimpleLayerPropCommand";
    }

    /// <summary>
    /// Occurs when this command is created
    /// </summary>
    /// <param name="hook">Instance of the application</param>
    public override void OnCreate(object hook)
    {
        if (hook == null)
            return;

        m_application = hook as IApplication;
        if (m_application != null)
        {
            switch (m_application.Name)
            {
                case "ArcMap":
                    m_layerCategoryID = "{1476c782-6f57-11d2-a2c6-080009b6f22b}";
                    break;
                case "ArcScene":
                    m_layerCategoryID = "{3f82c99b-1c5f-11d4-a381-00c04f6bc619}";
                    break;
                case "ArcGlobe":
                    m_layerCategoryID = "{720e21dc-2199-11d6-b2b3-00508bcdde28}";
                    break;
                default:
                    base.m_enabled = false;
                    break;
            }
        }
        else
            base.m_enabled = false;
    }

    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
       ** IComPropertySheet myPropertySheet = new ComPropertySheetClass();**
        myPropertySheet.Title = "Simplified Layer Properties (C#)";
        myPropertySheet.HideHelpButton = true;

        //Add by component category - all pages registered in the layer property page
        //UID layerPropertyID = new UIDClass();
        //layerPropertyID.Value = m_layerCategoryID;
        //myPropertySheet.AddCategoryID(layerPropertyID);

        //Or add page by page - but have to call Applies yourself
        myPropertySheet.ClearCategoryIDs();
        myPropertySheet.AddCategoryID(new UIDClass()); //a dummy empty UID
       // myPropertySheet.AddPage(new LayerVisibilityPage()); //my custom page
        myPropertySheet.AddPage(new ESRI.ArcGIS.CartoUI.LayerDrawingPropertyPageClass()); //feature layer symbology

        //Pass in layer, active view and the application
        ISet propertyObjects = new SetClass();
        IBasicDocument basicDocument = m_application.Document as IBasicDocument;

        propertyObjects.Add(basicDocument.ActiveView);
        propertyObjects.Add(basicDocument.SelectedLayer); //or check ContextItem is a layer?
        propertyObjects.Add(m_application); //optional?

        //Show the property sheet
        if (myPropertySheet.CanEdit(propertyObjects))
            myPropertySheet.EditProperties(propertyObjects, m_application.hWnd);
    }


            我用断点查看,每次运行到
             ** IComPropertySheet myPropertySheet = new ComPropertySheetClass();**
            这一行代码就自动弹出,也不报错也不实现,这是什么原因??有没有大神??
  • 写回答

2条回答 默认 最新

  • dabocaiqq 2016-11-12 15:01
    关注
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?