码迷,mamicode.com
首页 > 其他好文 > 详细

axTOCControl右键

时间:2015-09-22 07:45:37      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:

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

}

axTOCControl右键

标签:

原文地址:http://www.cnblogs.com/gisoracle/p/4827854.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!