Beispiel #1
0
 private void mapControl_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (checkBoxDrawPolygon.Checked && drawingPolygon != null)
     {
         polygons.Polygons.Add(drawingPolygon);
         drawingPolygon = null;
         drawingPoints.Clear();
     }
     else if (drawYuan.Checked)
     {
         yuanxingOverlay.Markers.Add(lastCircleMarker);
         lastCircleMarker = null;
         tempOverlay.Markers.Clear();
     }
 }
Beispiel #2
0
        private void mapControl_MouseMove(object sender, MouseEventArgs e)
        {
            var point = MapControl.MousePosition;

            latText.Text = e.X.ToString();
            lngText.Text = e.Y.ToString();

            if (drawYuan.Checked && e.Button == MouseButtons.Left)
            {
                lastPosition = mapControl.FromLocalToLatLng(e.X, e.Y);
                tempOverlay.Markers.Clear(); //擦出掉以前的marker

                //换算成以米为单位的距离
                int radius = (int)distanceByMeter(lastPosition.Lng, lastPosition.Lat, latLng.Lng, latLng.Lat);

                lastCircleMarker      = new GMapMarkerCircle(latLng, radius);
                lastCircleMarker.Fill = new SolidBrush(Color.FromArgb(50, Color.Red));
                tempOverlay.Markers.Add(lastCircleMarker);
            }
        }