Draggable ToolTip

Topics: Help
Jun 8, 2012 at 1:50 PM

Hi again,

I would like to create movable tooltips. So I create an invisible marker and add the tooltip with the texts.

GMarkerCross m = new GMarkerCross(path[0]);
m.IsVisible = true;
m.Pen.Color = Color.FromArgb(0, 255, 255, 255);
m.ToolTip = new GMapCTCustomToolTip(m);
m.ToolTipMode = MarkerTooltipMode.Always;
m.ToolTipText = (poly.Parent as SharpKml.Dom.Placemark).Name + " dBW";
m.ToolTip.Offset = new System.Drawing.Point(-5, -5);

private void mapController_MouseMove(object sender, MouseEventArgs e)
            // Drag markers around
            if (Control.MouseButtons == System.Windows.Forms.MouseButtons.Left)
                // Mouse button is pressed
                foreach (GMapOverlay o in mapController.Overlays)
                    foreach (GMapMarker m in o.Markers)
                        if ((m.ToolTip as GMapCTCustomToolTip).ToolTipRect.Contains(e.Location))
                            m.Position = mapController.FromLocalToLatLng(e.X, e.Y);

Whereas "GMapCTCustomToolTip" is just a subclass of GMapToolTip to make the rectangle public. Unfortunately the if-clause is never true. I assume that I have to translate the e.Location-point to the coordinate system of the GMap-Controller, but I can't see how at the moment.

I have the feeling that I'm doing something wrong here. Any suggestions?