|
阅读:1687回复:2
[求助]TOCControl右键删除层
<P><STRONG><FONT face=Verdana color=#61b713>TOCControl右键删除层</FONT></STRONG></P>
<P><STRONG><FONT face=Verdana color=#61b713>TOCControl1.HitTest x, y, pitem, pMap, m_pCurrentLayer, pOther, pIndex</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>m_pMap = Form1.MapControl1.Map<BR>m_pMap.DeleteLayer m_pCurrentLayer</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>可以删除没有存成的mxd的要素层,</FONT></STRONG><STRONG><FONT face=Verdana color=#61b713>怎么删不掉mxd的要素层呢?</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>请指点我一下吧,困扰很长时间了。<BR></P></FONT></STRONG> |
|
|
1楼#
发布于:2007-12-26 10:17
<P>楼上说的很对,你也可以尝试一下这么做:</P>
<P>m_pMap=Form1.MapControl1.FocusMap</P> <P>看一下m_pMap.LayerCount是否大于0;</P> <P>再看一下</P> <P><STRONG><FONT face=Verdana color=#61b713>TOCControl1.HitTest x, y, pitem, pMap, m_pCurrentLayer, pOther, pIndex</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>m_pCurrentLayer是否为空。</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>不为空就应该可以删除了。</FONT></STRONG></P> |
|
|
2楼#
发布于:2007-12-17 23:11
<P>通过pitem获取图层名称(pitem.Name)</P>
<P>然后再遍历MAP找到要删除的图层,然后delete即可</P> |
|
|