jaosn314
路人甲
路人甲
  • 注册日期2005-12-30
  • 发帖数3
  • QQ
  • 铜币112枚
  • 威望0点
  • 贡献值0点
  • 银元0个
10楼#
发布于:2006-01-02 17:45
VB.NET版
<P>  '~~ 使TOC事件可以拖曳圖層 ~~<BR>    '抓取要拖曳圖層<BR>    Private Sub AxTOCControl1_OnMouseDown(ByVal sender As Object, ByVal e As ESRI.ArcGIS.TOCControl.ITOCControlEvents_OnMouseDownEvent) Handles AxTOCControl1.OnMouseDown<BR>        If (e.button = 1) Then<BR>            Dim pMap As IMap = New MapClass<BR>            Dim pLayer As ILayer = New FeatureLayerClass<BR>            ' Dim pLegendGroup As ILegendGroup<BR>            Dim pLegendGroup As Object<BR>            Dim pItem As esriTOCControlItem = New esriTOCControlItem<BR>            Dim pIndex As Object<BR>            pSelSymLayer = Nothing</P>
<P>            '點選圖層或圖例<BR>            AxTOCControl1.HitTest(e.x, e.y, pItem, pMap, pLayer, pLegendGroup, pIndex)<BR>            If pLayer Is Nothing Then Exit Sub<BR>            If pItem = esriTOCControlItem.esriTOCControlItemLayer Then<BR>                '點中的是註記中的sublayer就退出<BR>                If TypeOf pLayer Is IAnnotationSublayer Then Exit Sub<BR>                pSelSymLayer = pLayer<BR>                'MsgBox(pSelSymLayer.Name)<BR>            ElseIf pItem = esriTOCControlItem.esriTOCControlItemLegendClass Then<BR>                '點中的是圖例<BR>                If TypeOf pLayer Is IFeatureLayer Then<BR>                End If<BR>            End If<BR>        End If<BR>    End Sub<BR>    '抓取放置位置<BR>    Private Sub AxTOCControl1_OnMouseMove(ByVal sender As Object, ByVal e As ESRI.ArcGIS.TOCControl.ITOCControlEvents_OnMouseMoveEvent) Handles AxTOCControl1.OnMouseMove<BR>        Dim pMap As IMap = New MapClass<BR>        Dim pLayer As ILayer = New FeatureLayerClass<BR>        Dim pLegendGroup As Object = Nothing<BR>        Dim pItem As esriTOCControlItem = New esriTOCControlItem<BR>        Dim pIndex As Object</P>
<P>        '實現調整圖層順序功能<BR>        If (e.button = 1) Then<BR>            AxTOCControl1.HitTest(e.x, e.y, pItem, pMap, pLayer, pLegendGroup, pIndex)<BR>        End If<BR>        If pItem <> esriTOCControlItem.esriTOCControlItemNone Then<BR>            Me.AxTOCControl1.MousePointer = esriControlsMousePointer.esriPointerPanning<BR>        End If</P>
<P>    End Sub<BR>    '執行放置圖層<BR>    Private Sub AxTOCControl1_OnMouseUp(ByVal sender As Object, ByVal e As ESRI.ArcGIS.TOCControl.ITOCControlEvents_OnMouseUpEvent) Handles AxTOCControl1.OnMouseUp<BR>        Dim pMap As IMap = New MapClass<BR>        Dim pLayer As ILayer = New FeatureLayerClass<BR>        Dim pLegendGroup As Object = Nothing<BR>        Dim pItem As esriTOCControlItem = New esriTOCControlItem<BR>        Dim pIndex As Object<BR>        Dim i As Integer, j As Integer<BR>        Dim bUpdataToc As Boolean<BR>        Me.AxTOCControl1.MousePointer = esriControlsMousePointer.esriPointerArrow</P>
<P>        '實現調整圖層順序功能<BR>        If (e.button = 1) Then<BR>            AxTOCControl1.HitTest(e.x, e.y, pItem, pMap, pLayer, pLegendGroup, pIndex)<BR>        End If</P>
<P>        If pItem = esriTOCControlItem.esriTOCControlItemLayer Or esriTOCControlItem.esriTOCControlItemLegendClass Then<BR>            If (pLayer Is Nothing) Or (pSelSymLayer Is Nothing) Or (pSelSymLayer Is pLayer) Then Exit Sub<BR>            If (e.button = 1) Then</P>
<P>                For i = 0 To AxMap_MapView.LayerCount - 1<BR>                    Dim pLayTmp As ILayer<BR>                    pLayTmp = AxMap_MapView.get_Layer(i)<BR>                    '得到點選當前的索引值<BR>                    If pLayer Is pLayTmp Then Exit For<BR>                Next i<BR>                '防止多次刷新<BR>                'TreeRedraw(Me.TOCLayer.hwnd, False)<BR>                On Error Resume Next<BR>                AxMap_MapView.Map.MoveLayer(pSelSymLayer, i)<BR>                On Error GoTo 0<BR>                'TreeRedraw(Me.TOCLayer.hwnd, True)<BR>            End If<BR>        End If<BR>    End Sub</P>
<P> <img src="images/post/smile/dvbbs/em01.gif" /></P>
<P><FONT color=#f70909>這是VB.NET版....不過請教各位高手.....是否可以在拖動圖層時...可以顯示...在那一個圖層上停住嗎?? 因為這樣可以比較知道在那一個圖層!!</FONT>  </P>
举报 回复(0) 喜欢(0)     评分
mms999
路人甲
路人甲
  • 注册日期2005-01-11
  • 发帖数13
  • QQ
  • 铜币212枚
  • 威望0点
  • 贡献值0点
  • 银元0个
11楼#
发布于:2006-02-20 16:29
<P>上面的所有代码都不能解决图层组的问题,是吗?</P>
举报 回复(0) 喜欢(0)     评分
kisssy
卧底
卧底
  • 注册日期2004-04-18
  • 发帖数235
  • QQ
  • 铜币614枚
  • 威望2点
  • 贡献值0点
  • 银元0个
12楼#
发布于:2006-02-24 15:50
<img src="images/post/smile/dvbbs/em04.gif" /><img src="images/post/smile/dvbbs/em08.gif" />
个人专栏: https://zhuanlan.zhihu.com/c_165676639
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15945
  • QQ554730525
  • 铜币25337枚
  • 威望15352点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
13楼#
发布于:2006-02-28 12:27
<DIV class=quote><B>以下是引用<I>mms999</I>在2006-2-20 16:29:26的发言:</B><BR>
<P>上面的所有代码都不能解决图层组的问题,是吗?</P></DIV>
<P>这个需要加入图层类型的判断</P>
举报 回复(0) 喜欢(0)     评分
edwardted
路人甲
路人甲
  • 注册日期2005-03-01
  • 发帖数11
  • QQ
  • 铜币189枚
  • 威望0点
  • 贡献值0点
  • 银元0个
14楼#
发布于:2006-03-19 23:07
<P>kankan</P>
举报 回复(0) 喜欢(0)     评分
zhaowsd
路人甲
路人甲
  • 注册日期2004-05-31
  • 发帖数11
  • QQ
  • 铜币179枚
  • 威望0点
  • 贡献值0点
  • 银元0个
15楼#
发布于:2006-03-22 22:04
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
liaokobe
路人甲
路人甲
  • 注册日期2006-01-17
  • 发帖数36
  • QQ
  • 铜币52枚
  • 威望0点
  • 贡献值0点
  • 银元0个
16楼#
发布于:2006-03-24 15:58
非常感谢,估计SceneControl的控制代码也是类似的吧。
举报 回复(0) 喜欢(0)     评分
tangrf
路人甲
路人甲
  • 注册日期2004-04-10
  • 发帖数45
  • QQ
  • 铜币285枚
  • 威望0点
  • 贡献值0点
  • 银元0个
17楼#
发布于:2006-06-09 17:21
<P>有.NET2003(C#)版的没??我把你们的改成C#了,在控制TOC刷新时,TreeRedraw(Me.TOCLayer.hwnd, True)里的SendMessage(...)是受保护的,请问,还有其他方法没??</P>
举报 回复(0) 喜欢(0)     评分
始祖鸟
路人甲
路人甲
  • 注册日期2004-08-02
  • 发帖数37
  • QQ
  • 铜币203枚
  • 威望0点
  • 贡献值0点
  • 银元0个
18楼#
发布于:2006-09-26 21:20
<P>哭,我怎么做不起来啊,我用C#</P>
举报 回复(0) 喜欢(0)     评分
hahaaluo
路人甲
路人甲
  • 注册日期2006-08-05
  • 发帖数146
  • QQ
  • 铜币591枚
  • 威望0点
  • 贡献值0点
  • 银元0个
19楼#
发布于:2006-09-28 16:03
好 辛苦了~~~~~~~
举报 回复(0) 喜欢(0)     评分
上一页 下一页
游客

返回顶部