Yale,
I wrote a sample app according to the requirements of Carlos Angelo where you track a reactangle, edit it and then stop showing the editing options and be able to track a new rectangle again by clicking on a button . See the code below. An error occurs at the line winformsMap1.Refresh(); in btnMisc_Click. Why is this error happening? Am I doing something wrong or is it a bug?
Carlos Angelo,
Thank you for your patience. What you are asking is possible and we will show you the final result after we resolve those issues.
private void LoadPost9069()
{
winformsMap1.ThreadingMode = MapThreadingMode.SingleThreaded;
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = new RectangleShape(-84, 11, -64, 0);
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));
winformsMap1.TrackOverlay.TrackEnded += new EventHandler<TrackEndedTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackEnded);
winformsMap1.TrackOverlay.TrackMode = TrackMode.Rectangle;
winformsMap1.Refresh();
}
private void TrackOverlay_TrackEnded(object sender, TrackEndedTrackInteractiveOverlayEventArgs args)
{
winformsMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear();
winformsMap1.TrackOverlay.TrackMode = TrackMode.None;
RectangleShape rectangleShape = (RectangleShape)args.TrackShape;
winformsMap1.EditOverlay.EditShapesLayer.InternalFeatures.Add(new Feature(rectangleShape));
winformsMap1.EditOverlay.CanRotate = true;
winformsMap1.EditOverlay.CanAddVertex = true;
winformsMap1.EditOverlay.CanDrag = true;
winformsMap1.EditOverlay.CanRemoveVertex = true;
winformsMap1.EditOverlay.CanReshape = true;
winformsMap1.EditOverlay.CanResize = true;
winformsMap1.EditOverlay.CalculateAllControlPoints();
winformsMap1.Refresh();
}
private void btnMisc_Click(object sender, EventArgs e)
{
winformsMap1.EditOverlay.CanRotate = false;
winformsMap1.EditOverlay.CanAddVertex = false;
winformsMap1.EditOverlay.CanDrag = false;
winformsMap1.EditOverlay.CanRemoveVertex = false;
winformsMap1.EditOverlay.CanReshape = false;
winformsMap1.EditOverlay.CanResize = false;
winformsMap1.EditOverlay.CalculateAllControlPoints();
winformsMap1.TrackOverlay.TrackMode = TrackMode.Rectangle;
winformsMap1.Refresh(); //"The given key was not present in the dictionary" error occurs here.
}