阅读:1459回复:0
请教关于vb.net+mapx 鹰眼
<P>各位大侠,我是搞土木的,计算机语言和gis方面算门外汉,老师让我们做vb.net+MAPX的论文,遇到问题请教各位!希望不吝赐教</P>
<P> 鹰眼,我从网上找了段程序自己改了一下,可以实现点击小图看大图的功能,也就是小图点某个地方大图会转到某处,但是在小图上就是不出现方框,另外移动大图时小图没有动静,请问怎么回事啊</P> <P> 添加两个mapx控件,AxMap1为主图,AxMap2为鹰眼图,</P> <P> Dim m_Layer As MapXLib.Layer '鹰眼图上临时图层 <BR> Dim m_Fea As MapXLib.Feature '鹰眼图上反映主地图窗口位置的Feat</P> <P><BR> Private Sub Form_Load()<BR> m_Layer = AxMap2.Layers.CreateLayer("Rectlayer") '在Map2创建图层 <BR> End Sub<BR> Private Sub AxMap2_MouseDownEvent(ByVal eventSender As System.Object, ByVal eventArgs As AxMapXLib.CMapXEvents_MouseDownEvent) Handles AxMap2.MouseDownEvent<BR> Dim MapX As Double<BR> Dim MapY As Double<BR> Dim X As Single = eventArgs.x<BR> Dim Y As Single = eventArgs.y<BR> If AxMap2.MouseButtons = MouseButtons.Left Then<BR> AxMap2.ConvertCoord(X, Y, MapX, MapY, 1)<BR> AxMap1.CenterX = MapX<BR> AxMap1.CenterY = MapY<BR> End If<BR> '在主界面显示鹰眼图中选中的矩形区域的功能可以在此处添加 <BR> End Sub<BR> Private Sub AxMap1_MapViewChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxMap1.MapViewChanged<BR> Dim tempFea As MapXLib.Feature '声明Feature变量 <BR> Dim tempPnts As MapXLib.Points '声明Points变量 <BR> Dim tempStyle As MapXLib.Style '声明Style变量 </P> <P> If m_Layer.AllFeatures.Count = 0 Then<BR> '设置矩形边框样式 <BR> tempStyle = New MapXLib.Style '创建Style对象 <BR> tempStyle.RegionPattern = MapXLib.FillPatternConstants.miPatternNoFill '设置Style的矩形内部填充样式 </P> <P> tempStyle.RegionBorderColor = System.Convert.ToUInt32(255) '设置Style的矩形边框颜色 255 <BR> tempStyle.RegionBorderWidth = 2 '设置Style的矩形边框宽度 </P> <P> '在图层创建大小为Map1的边界的Rectangle对象 <BR> tempFea = AxMap2.FeatureFactory.CreateRegion(Axmap1.CtlBounds, tempStyle)<BR> m_Fea = m_Layer.AddFeature(tempFea) '添加矩形边框 <BR> Else '否则,根据AxMapMain的视野变化改变矩形边框的大小和位置 <BR> With m_Fea.Parts.Item(1)<BR> .RemoveAll() '除去已有的矩形边框的顶点 <BR> '添加大小和位置已变化的矩形边框的四个顶点 <BR> .AddXY(Axmap1.CtlBounds.XMin, Axmap1.CtlBounds.YMin)<BR> .AddXY(Axmap1.CtlBounds.XMax, Axmap1.CtlBounds.YMin)<BR> .AddXY(Axmap1.CtlBounds.XMax, Axmap1.CtlBounds.YMax)<BR> .AddXY(Axmap1.CtlBounds.XMin, Axmap1.CtlBounds.YMax)<BR> End With<BR> m_Fea.Update() '更新显示 <BR> End If<BR> End Sub</P> |
|