阅读:2682回复:8
一个选中元素如何取消选中问题??
<P>我先是选中某个图层中的一个数据
使其选中几个元素 g_pMap.SelectFeature pFeatureLayer, pfeature 选中一个元素 我要实现的功能是: 比如选中了三个元素,现在其中一个元素不需要了,要使其不选中 可有办法将我选中的某一个元素不选中啊!!!</P> |
|
1楼#
发布于:2005-02-01 11:28
<P>简单的方法就是按ctrl和shift,添加和取消选择都行</P>
[此贴子已经被作者于2005-2-1 11:31:42编辑过]
|
|
|
2楼#
发布于:2005-02-02 00:26
<P>不是很明白</P><P>可否说的详细点吗??</P><P>谢谢了!!</P>
|
|
3楼#
发布于:2005-02-02 11:42
<P>要自己写代码来实现。响应ctrl和shift键按下的消息。哪个加图元,哪个减图元由你自己定好了</P>
|
|
4楼#
发布于:2005-02-02 11:42
<P>我有关于VB写好的代码,你要吗?</P>
|
|
5楼#
发布于:2005-02-02 22:14
<P>要啊!!!</P><P>问题是减图元怎么实现啊!!!</P><P>发到邮箱里<a href="mailtyejian8109@yahoo.com.cn" target="_blank" >yejian8109@yahoo.com.cn</A></P><img src="images/post/smile/dvbbs/em02.gif" />
|
|
6楼#
发布于:2005-02-03 11:42
<P>可以通过ISelectionSet的RemoveList方法,就可以实现取消一个要素的选择
IFeatureSelection pFeatureSelection = pFeatureLayer as IFeatureSelection; ISelectionSet pSelectionSet = pFeatureSelection.SelectionSet; int oID = m_pSelectedNodeFeature.OID; pSelectionSet.RemoveList(1, ref oID);</P><P> pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, pActiveView.Extent);</P> |
|
|
7楼#
发布于:2005-02-04 22:16
<P>谢谢帮助!!</P><P>功能已经实现了!!</P><P> 顺便问一下,你给的程序写法是VC++还是Delphi或是其他的啊???</P><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
|
|
8楼#
发布于:2005-02-04 22:24
<P>一下是实现的代码:VB的</P><P>Dim pFeatureLayer As esriCore.IFeatureLayer
Dim j As Long Dim pActiveView As esriCore.IActiveView 'Dim whereClause As String Dim pFilter As esriCore.IQueryFilter Dim pFCusrsor As IFeatureCursor Dim pfeature As IFeature Set pActiveView = g_pMap pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing For j = 0 To g_pMap.LayerCount - 1 If g_pMap.Layer(j).name = layername Then Set pFeatureLayer = g_pMap.Layer(j) Set pFilter = New QueryFilter pFilter.whereClause = whereClause Set pFCusrsor = pFeatureLayer.FeatureClass.Search(pFilter, True) Set pfeature = pFCusrsor.NextFeature If pfeature Is Nothing Then MsgBox "没找到!!!", vbCritical, "系统信息:" Exit Sub End If Dim pFeatureselection As IFeatureSelection Dim pSelectionSet As ISelectionSet Set pFeatureselection = pFeatureLayer Set pSelectionSet = pFeatureselection.SelectionSet pSelectionSet.RemoveList 1, pfeature.OID showcolor CDbl(MSFlexGrid1.row), vbWhite j = g_pMap.LayerCount End If Next j pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing</P><P>pSelectionSet.RemoveList <FONT color=#f70909>1</FONT>, pfeature.OID</P><P>pSelectionSet.RemoveList第一个参数不是很明白,可否讲解一下啊!!!</P> |
|