11楼#
发布于:2004-05-20 16:12
<P>try this:</P><P>Option Explicit
Private selflag As Boolean '选择标志 Private Sub Command1_Click() selflag = True End Sub</P><P>Private Sub Form_Load() selflag = False</P><P>End Sub</P><P>Private Sub MapControl1_OnMouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long, ByVal mapX As Double, ByVal mapY As Double) If selflag = True Then Dim pSelEnv As ISelectionEnvironment Dim pRgbColor As IRgbColor Set pSelEnv = New SelectionEnvironment Set pRgbColor = New RgbColor pRgbColor.Red = 255 pSelEnv.AreaSelectionMethod = esriSpatialRelIntersects Set pSelEnv.DefaultColor = pRgbColor Dim pEnv As IEnvelope Dim pRubber As IRubberBand Set pRubber = New RubberEnvelope Dim pActiveView As IActiveView Set pActiveView = MapControl1.ActiveView Set pEnv = pRubber.TrackNew(pActiveView.ScreenDisplay, Nothing) pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing MapControl1.Map.SelectByShape pEnv, pSelEnv, False pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing selflag = False End If End Sub </P><P>Goodluck!</P> |
|
|
12楼#
发布于:2004-05-20 12:54
<P>给你点建议哦!</P><P>在例子中有个QueryCommand.vbp,其中有个用不同的shape来选择地物的功能,你只需要将它看懂,然后将被选中的地物的属性读取出来就可以了!呵呵,反正我是这样做的,搞定了!而且例子很简单,代码不是太复杂,我都看懂了,你应该也能!嘻嘻</P><img src="images/post/smile/dvbbs/em02.gif" />
|
|
|
上一页
下一页