Wrong marker position

Dec 4, 2009 at 10:44 AM

Hello,

I try to place custommarker on location where user clicks. But marker always appears at upper left corner of mapcontrol. Stepping in code shows me the right values.

What can be wrong in code?

 

Dim myPosition As System.Windows.Point = Mouse.GetPosition(GMapControl1)
Dim myPoint As GMap.NET.PointLatLng
myPoint = GMapControl1.FromLocalToLatLng(CInt(myPosition.X), CInt(myPosition.Y))
Dim myMarker As GMapMarker = New GMap.NET.WindowsPresentation.GMapMarker(myPoint)
myMarker.Position = myPoint

Dim myCircle As New Ellipse
myCircle.Height = 5
myCircle.Width = 5
myCircle.Fill = Windows.Media.Brushes.Black
myMarker.Shape = myCircle
GMapControl1.Markers.Add(myMarker)

I use same principal for using a polygon as marker and that works

<font size="2">

 

</font>

 

 

 

Heru

Coordinator
Dec 4, 2009 at 11:09 AM

because your marker doesn't have offset, call myMarker.ForceUpdateLocalPosition(GMapControl);

Dec 4, 2009 at 11:22 AM

Radioman,

Again: THANX.

Heru