private void axTOCControl1_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e)
{
if (e.button != 2) return;

esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
IBasicMap map = null; ILayer layer = null;
object other = null; object index = null;

//Determine what kind of item is selected
m_tocControl.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);

//Ensure the item gets selected
if (item == esriTOCControlItem.esriTOCControlItemMap)
m_tocControl.SelectItem(map, null);
else
m_tocControl.SelectItem(layer, null);

//Set the layer into the CustomProperty (this is used by the custom layer commands)
m_mapControl.CustomProperty = layer;

//Popup the correct context menu
if (item == esriTOCControlItem.esriTOCControlItemMap) m_menuMap.PopupMenu(e.x, e.y, m_tocControl.hWnd);
if (item == esriTOCControlItem.esriTOCControlItemLayer) m_menuLayer.PopupMenu(e.x, e.y, m_tocControl.hWnd);

}

最新文章

  1. STL容器分类
  2. linux下使用tar命令
  3. openssl evp RSA 加密解密
  4. UI控件
  5. 手写一个更好用的performSelector/msgSend(详细修改版)
  6. 读者写者问题继 读写锁SRWLock
  7. 杭电ACM2011-- 多项式求和
  8. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-010-Introduction为类增加新方法@DeclareParents、<aop:declare-parents>
  9. Thread.sleep(0)的意义
  10. QF——iOS沙盒机制
  11. 5.4.2 RegExp实例方法
  12. 开源数据库连接池之Tomcat内置连接池
  13. 【转】title与alt的区别
  14. PL/SQL Developer使用技巧以及快捷键设置
  15. Python进程-实现
  16. Chrome浏览器vue-devtools插件安装教程
  17. git的安装(和远程仓库建立连接)
  18. mybatis 中 foreach collection的三种用法
  19. 定位z-index
  20. Java线程池ThreadPoolExecutor

热门文章

  1. pythonweb框架Flask学习笔记04-模板继承
  2. nginx添加认证
  3. Android UiAutomator UiDevice API
  4. RabbitMQ : 几种Exchange 模式
  5. Eclipse-查看jar源码乱码问题解决
  6. javascript中的浅拷贝和深拷贝 分类: JavaScript 2015-05-07 15:29 831人阅读 评论(1) 收藏
  7. mysql5.6常用查询sql
  8. Linux笔记:linux常用命令
  9. Go语言学习笔记七: 函数
  10. Hive文件存储格式和hive数据压缩