コード例 #1
0
        private void MouseMoved(object sender, MouseMovedTrackInteractiveOverlayEventArgs e)
        {
            //Gets the shape as it is being tracked and gets its properties to be displayed in labels og groupbox
            AreaBaseShape areaBaseShape = (AreaBaseShape)winformsMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetShape();
            double        Perimeter     = Math.Round(areaBaseShape.GetPerimeter(winformsMap1.MapUnit, DistanceUnit.Kilometer));
            double        Area          = Math.Round(areaBaseShape.GetArea(winformsMap1.MapUnit, AreaUnit.SquareKilometers));

            lblPerimeter.Text = String.Format("{0:0,0}", Perimeter) + " km";
            lblArea.Text      = String.Format("{0:0,0}", Area) + " km2";

            //Sets the location (in screen coordinates) of the groupbox according to last moved vertex of the tracked shape (in world coordinates).
            ScreenPointF screenPointF = ThinkGeo.MapSuite.Core.ExtentHelper.ToScreenCoordinate(winformsMap1.CurrentExtent, e.MovedVertex.X, e.MovedVertex.Y, winformsMap1.Width, winformsMap1.Height);

            groupBoxInfo.Location = new Point((int)screenPointF.X + 30, (int)screenPointF.Y + 10);
        }