void Map_ViewChangedEvent(object sender, MapInfo.Mapping.ViewChangedEventArgs e) { // Display the zoom level Double dblZoom = System.Convert.ToDouble(String.Format("{0:E2}", mapControl1.Map.Zoom.Value)); if (statusStrip1.Items.Count > 0) { statusStrip1.Items[0].Text = "缩放: " + dblZoom.ToString() + " " + MapInfo.Geometry.CoordSys.DistanceUnitAbbreviation(mapControl1.Map.Zoom.Unit); } }
void Map_ViewChangedEvent(object sender, MapInfo.Mapping.ViewChangedEventArgs e) { // Display the zoom level Double dblZoom = System.Convert.ToDouble(String.Format("{0:E2}", mapControl1.Map.Zoom.Value)); if (statusStrip1.Items.Count > 0) { statusStrip1.Items[0].Text = "缩放: " + dblZoom.ToString() + " " + MapInfo.Geometry.CoordSys.DistanceUnitAbbreviation(mapControl1.Map.Zoom.Unit); } if (Session.Current.Catalog.GetTable("EagleEyeTemp") == null) { loadEagleLayer(); } Table tblTemp = Session.Current.Catalog.GetTable("EagleEyeTemp"); try { (tblTemp as ITableFeatureCollection).Clear(); } catch (Exception) { } try { // 主地图发生改变是对鹰眼地图进行相应的画框操作 if (mapControl2.Map.Layers["MyEagleEye"] != null) { mapControl2.Map.Layers.Remove(eagleEye); } DRect rect = mapControl1.Map.Bounds; FeatureGeometry fg = new MapInfo.Geometry.Rectangle(mapControl1.Map.GetDisplayCoordSys(), rect); SimpleLineStyle vLine = new SimpleLineStyle(new LineWidth(2, LineWidthUnit.Point), 2, Color.Red); SimpleInterior vInter = new SimpleInterior(9, Color.Yellow, Color.Yellow, true); CompositeStyle cStyle = new CompositeStyle(new AreaStyle(vLine, vInter), null, null, null); fRec = new Feature(fg, cStyle); tblTemp.InsertFeature(fRec); eagleEye = new FeatureLayer(tblTemp, "EagleEye ", "MyEagleEye"); mapControl2.Map.Layers.Insert(0, eagleEye); } catch (Exception) { } }