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));
                    }
                }
            }


  • 相关阅读:
    Delphi接口的底层实现
    Delphi实现图像文本旋转特效完整代码
    delphi 原创应用工具箱
    用Delphi制作DLL
    Delphi在StatusBar上绘制ProgressBar
    Delphi之TDrawGrid绘制
    基于Delphi的接口编程入门
    Delphi中For In 语法应用实例
    w3c与微软(IE)事件注册区别 -Tom
    js 函数-Tom
  • 原文地址:https://www.cnblogs.com/dengshiwei/p/3971487.html
Copyright © 2011-2022 走看看