zoukankan      html  css  js  c++  java
  • TreeList控件右键菜单功能的实现

    <p>TreeList控件实现右键菜单功能,其实跟TocControl控件实现原理是一样的,TocControl也是利用一个ContextMenu控件,利用HitT方法,TreeList利用其ContextMenuStrip属性就可以。</p><p>TocControl实现右键功能:</p>
     private void MenuList_MouseDown(object sender, MouseEventArgs e)
            {
                //绑定右键菜单
                if (e.Button == MouseButtons.Right)
                {
                    MenuList.ContextMenu = null;
                    TreeListHitInfo hInfo = MenuList.CalcHitInfo(new Point(e.X, e.Y));
                    TreeListNode node = hInfo.Node;
                    MenuList.FocusedNode = node;
                    if (node != null)
                    {
                        MenuList.ContextMenuStrip = contextMenu;
                    }
                }
            }

    TreeList实现右键功能:

      private void axTOCControl_OnMouseDown_1(object sender, ITOCControlEvents_OnMouseDownEvent e)
            {
    
                if (e.button == 2)
                {
                    esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
                    IBasicMap m_BasicMap = null;
                    ILayer m_Layer = null;
                    object other = null;
                    object index = null;
                    axTOCControl.HitTest(e.x, e.y, ref item, ref m_BasicMap, ref m_Layer, ref other, ref index);
                    g_Layer = m_Layer;
                    if (item == esriTOCControlItem.esriTOCControlItemLayer)
                    {
                        cMStoc.Show(axTOCControl, new System.Drawing.Point(e.x, e.y));
                    }
                }
            }


  • 相关阅读:
    使用eclipse创建Spring Boot项目
    Oracle 一个表的数据update到另一个表
    C3P0连接池属性配置注释
    Druid连接池
    Oracle 五笔码函数
    Oracle 拼音码函数
    JAVA JDK环境变量配置
    一 测试基础之测试方法
    SonarQube+Jenkins,搭建持续交付平台
    swagger集成到springBoot 项目中
  • 原文地址:https://www.cnblogs.com/dengshiwei/p/4258771.html
Copyright © 2011-2022 走看看