qunneizuzhi
路人甲
路人甲
  • 注册日期2007-08-19
  • 发帖数23
  • QQ
  • 铜币264枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1588回复:0

不显示鹰眼红框

楼主#
更多 发布于:2009-05-10 17:18
<P>本人初学模仿写了一段代码用于鹰眼地图 怎么不显示鹰眼红框 还望高手指教  采用arcgis engine 9.2</P>
<P>Private m_pEnvelope As IEnvelope <WBR> <WBR> <BR>Private m_pFillSymbol As ISimpleFillSymbol<BR>Private  m_pTransformEvents AsdisplayTransformation<BR><BR>2.<FONT face=宋体>定义如下函数:</FONT><BR>Private Sub CreateOverviewSymbol() <WBR> <WBR> '<FONT face=宋体>设置鹰眼图中的红线框</FONT><BR> <WBR> <WBR> 'Get the IRgbColor interface.<BR> <WBR> <WBR> Dim pColor As IRgbColor<BR> <WBR> <WBR> Set pColor = New RgbColor<BR> <WBR> <WBR> 'Set the color properties.<BR>pColor.RGB = RGB(255, 0, 0)<BR> <WBR> <WBR> 'Get the ILine symbol interface.<BR> <WBR> <WBR> Dim pOutline As ILineSymbol<BR> <WBR> <WBR> SetpOutline = New SimpleLineSymbol<BR> <WBR> <WBR> <WBR> <WBR> 'Set the line symbol properties.<BR>pOutline.Width = 1.5<BR>pOutline.Color = pColor<BR> <WBR> <WBR> 'Get the IFillSymbol interface.<BR> <WBR> <WBR> Setm_pFillSymbol = New SimpleFillSymbol<BR> <WBR> <WBR> 'Set the fill symbol properties.<BR>m_pFillSymbol.Outline = pOutline<BR>m_pFillSymbol.Style = esriSFSHollow<BR>End Sub<BR><BR>Private Sub MapControl2_OnAfterDraw(ByValdisplay As Variant, ByVal viewDrawPhase As Long)<BR> <WBR> <WBR> Ifm_pEnvelope Is Nothing Then Exit Sub<BR> <WBR> <WBR> 'If the foreground phase has drawn<BR> <WBR> <WBR> DimpViewDrawPhase As esriViewDrawPhase<BR>pViewDrawPhase = viewDrawPhase<BR> <WBR> <WBR> IfpViewDrawPhase = esriViewForeground Then<BR> <WBR> <WBR> <WBR> <WBR> 'Draw the shape on the MapControl.<BR> <WBR> <WBR> <WBR> MapControl2.DrawShape m_pEnvelope, m_pFillSymbol<BR> <WBR> <WBR> EndIf<BR>End Sub<BR><BR>Private Sub m_pTransformEvents_VisibleBoundsUpdated(ByValsender As esriDisplay.IDisplayTransformation, ByVal sizeChanged As Boolean)<BR> <WBR> <WBR> 'Set the extent to the new visible extent.<BR> <WBR> <WBR> Setm_pEnvelope = sender.VisibleBounds<BR> <WBR> <WBR> 'Refresh the MapControl's foreground phase.<BR> <WBR> <WBR> MapControl2.RefreshesriViewForegroun<WBR>d<BR>End Sub<BR><BR><FONT face=宋体>在</FONT>Form_Load <FONT face=宋体>事件中调用</FONT>CreateOverviewSymbol<FONT face=宋体>:</FONT><BR>Private Sub Form_Load()<BR> <WBR> <WBR> <WBR> Call CreateOverviewSymbol<BR>End Sub<BR><BR><FONT face=宋体>在</FONT>MapControl1<FONT face=宋体>的</FONT>OnMapReplaced<FONT face=宋体>中加入以下代码:</FONT><BR>Private Sub MapControl1_OnMapReplaced(ByValnewMap As Variant)<BR> <WBR> <WBR> '<FONT face=宋体>当主地图显示控件的地图改变时,鹰眼中的地图也跟随改变</FONT><BR> <WBR> <WBR> 'Get the IActiveView of the focus map in the PageLayoutControl.<BR> <WBR> <WBR> DimpActiveView As IActiveView<BR> <WBR> <WBR> SetpActiveView = MapControl1.ActiveView.FocusMap<BR> <WBR> <WBR> 'Trap the ITransformEvents of the PageLayoutControl's focus map.<BR> <WBR> <WBR> Setm_pTransformEvents = pActiveView.ScreenDisplay.displayTransformation<BR> <WBR> <WBR> 'Get the extent of the focus map.<BR> <WBR> <WBR> Setm_pEnvelope = pActiveView.Extent<BR> <WBR> <WBR> 'Load the same preauthored map document into the MapControl.<BR>MapControl2.LoadMxFile MapControl1.DocumentFilename<BR> <WBR> <WBR> 'Set the extent of the MapControl to the full extent of the data.<BR>MapControl2.Extent = MapControl2.FullExtent<BR>End Sub<BR><BR><FONT face=宋体>当点击鹰眼中的某个地方时,主窗口的地图跟随着改变:</FONT><BR>Private Sub MapControl2_OnMouseDown(ByValbutton As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long, ByValmapX As Double, ByVal mapY As Double)<BR> <WBR> <WBR> <WBR> Dim pPt As IPoint<BR> <WBR> <WBR> <WBR> Set pPt = New Point<BR> <WBR> <WBR> <WBR> pPt.PutCoords mapX, mapY<BR>'<FONT face=宋体>改变主控件的视图范围</FONT><BR>MapControl1.CenterAt pPt<BR>End Sub<BR><FONT face=宋体>这样地图鹰眼就做好了。</FONT><BR><BR><BR></P>
喜欢0 评分0
游客

返回顶部