Exemple #1
0
 private void gMapControl1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         string      file   = Application.StartupPath + "\\icon\\right.png";
         PointLatLng point  = gMapControl1.FromLocalToLatLng(e.X, e.Y);
         Bitmap      bitmap = Bitmap.FromFile(file) as Bitmap;
         GMapMarker  gmm    = new GMapMarkerImage(point, bitmap);
         gmm.ToolTipText = string.Format("x:{0}  y:{1}", point.Lat, point.Lng);
         gmm.ToolTipMode = MarkerTooltipMode.OnMouseOver;
         this.MyMark.Markers.Add(gmm);
         //ddd
         drawingPoints.Add(point);
         if (drawingPolygon == null)
         {
             drawingPolygon                  = new GMapPolygon(drawingPoints, "my polygon");
             drawingPolygon.Fill             = new SolidBrush(Color.FromArgb(50, Color.Red));
             drawingPolygon.Stroke           = new Pen(Color.Blue, 1);
             drawingPolygon.IsHitTestVisible = true;
             polygons.Polygons.Add(drawingPolygon);
         }
         else
         {
             drawingPolygon.Points.Clear();
             drawingPolygon.Points.AddRange(drawingPoints);
             if (polygons.Polygons.Count == 0)
             {
                 polygons.Polygons.Add(drawingPolygon);
             }
             else
             {
                 gMapControl1.UpdatePolygonLocalPosition(drawingPolygon);
             }
         }
     }
 }
Exemple #2
0
        private void gMapControl1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                string file = Application.StartupPath + "\\icon\\right.png";
                PointLatLng point = gMapControl1.FromLocalToLatLng(e.X, e.Y);
                Bitmap bitmap = Bitmap.FromFile(file) as Bitmap;
                GMapMarker gmm = new GMapMarkerImage(point, bitmap);
                gmm.ToolTipText = string.Format("x:{0}  y:{1}", point.Lat, point.Lng);
                gmm.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                this.MyMark.Markers.Add(gmm);
                //ddd
                drawingPoints.Add(point);
                if (drawingPolygon == null)
                {
                    drawingPolygon = new GMapPolygon(drawingPoints, "my polygon");
                    drawingPolygon.Fill = new SolidBrush(Color.FromArgb(50, Color.Red));
                    drawingPolygon.Stroke = new Pen(Color.Blue, 1);
                    drawingPolygon.IsHitTestVisible = true;
                    polygons.Polygons.Add(drawingPolygon);
                }
                else
                {
                    drawingPolygon.Points.Clear();
                    drawingPolygon.Points.AddRange(drawingPoints);
                    if (polygons.Polygons.Count == 0)
                    {
                        polygons.Polygons.Add(drawingPolygon);
                    }
                    else
                    {
                        gMapControl1.UpdatePolygonLocalPosition(drawingPolygon);
                    }
                }
            
            }          

        }