judero01col / GMap.NET

GMap.NET Windows Forms & Presentation is an excellent open source, powerful, free and cross-platform .NET control. Allows the use of routing, geocoding, directions and maps from Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yendux, Mapy.cz, Maps.lt, iKarte.lv, NearMap, HereMap, CloudMade, WikiMapia, MapQuest and many more.
Other
466 stars 205 forks source link

Centering the Marker #200

Open Fedor85 opened 11 months ago

Fedor85 commented 11 months ago

Hello! I have a few questions about working with maps! 1) how can I achieve centering of a marker that is being built through ItemTemplate? GMapMarker has the property Offset which I can use as an example:

         **GMapMarker marker = new GMapMarker(new PointLatLng(66.4169575018027, 94.25025752215694));
        marker.PropertyChanged += Marker_PropertyChanged;
        Rectangle recShape = new Rectangle
        {
            Width = 15,
            Height = 15,
            Fill = System.Windows.Media.Brushes.BlueViolet
        };
        marker.Shape = recShape;
        marker.Offset = new Point(-recShape.Width / 2, -recShape.Height / 2);**

  But how can it be used when filling through ItemTemplate? I tried to track the event PropertyChanged.
  But it works if you precede Shape in the code itself, as in the example above, but it doesn’t work through ItemTemplate!

2) Using the example above, I set one marker with centering! but the result was not correct: image and only when you change the size of the form, the marker moves to the right place along the center image why such strange behavior? 3)I have a setting MapControl.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter; image Zoom does not work in this position, although I want to bring the marker closer!How to solve this problem?