public class CustomZoomInMapAction : ZoomInMapAction { public CustomZoomInMapAction() { this.Map.Paint += new System.EventHandler<ESRI.ArcGIS.Mobile.MapPaintEventArgs>(Map_Paint); } void Map_Paint(object sender, MapPaintEventArgs e) { e.Display.DrawEnvelope(. . .); } }
using System; using System.Windows.Forms; using ESRI.ArcGIS.Mobile; using ESRI.ArcGIS.Mobile.Geometries; using ESRI.ArcGIS.Mobile.MapActions; using ESRI.ArcGIS.Mobile.MobileServices; namespace xyz { /// <summary> /// Move a feature by mouse drag /// </summary> internal class MovePointMapAction : MapAction { private ToolStripButton _controlButton; public MovePointMapAction() { StatusChanged += delegate(object o, MapActionStatusChangedEventArgs e) { if (e.StatusId == Activated) { if (Map != null) { Map.Focus(); Map.Cursor = Cursors.Cross; if (_controlButton != null) { _controlButton.Checked = true; } } } if (e.StatusId == Deactivated) { ActionInProgress = false; if (Map != null) { if (_controlButton != null) { _controlButton.Checked = false; } Map.Cursor = Cursors.Default; } } }; } public ToolStripButton ControlButton { set { _controlButton = value; } } protected override void OnMapMouseDown(MapMouseEventArgs e) { ActionInProgress = true; Map.SuspendDrawing = true; } protected override void OnMapMouseUp(MapMouseEventArgs e) { if (ActionInProgress == false && Map.IsValid == false) return; Point lPoint = new Point(e.MapCoordinate); if (Map.GetFullExtent().Contains(lPoint.Coordinate)) { try { FormIdentifyNavi lIdentifyForm = ((FormMap) Map.Parent).FormIdentify; FeatureDataRow lDataRow = lIdentifyForm.CurrentRow; Point lOldPoint = lDataRow[lDataRow.FeatureLayer.GeometryColumnIndex] as Point; if (lOldPoint != null) lOldPoint.Coordinate = lPoint.Coordinate; } catch (Exception ee) { MessageBox.Show(ee.Message, Messages.Error); } } Map.SuspendDrawing = false; ActionInProgress = false; Map.Invalidate(); } // Properties protected override void Dispose(bool disposing) { base.Dispose(disposing); ActionInProgress = false; } public override string ToString() { return "MovePointAction"; } } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.