Tool Tip Size

Oct 6, 2009 at 1:47 AM

Hi! I really appreciate your work here. I am placing 100 to 200 markers on a map from a database. I need to change the size of the tool tip (text) so the map can be looked at and printed. Each tool tip just displays a name next to the marker

Oct 6, 2009 at 12:33 PM

overlay.TooltipFont, you can even overload it: protected virtual void DrawToolTip(Graphics g, GMapMarker m, int x, int y)

Oct 10, 2009 at 9:46 AM

Radioman,

Thanks for your hard work.

The TooltipFont work perfectly, while I think the tooltip can only work(display) when setting the

cm.TooltipMode = MarkerTooltipMode.Always;

 

If I Set the Tooltip to another way:

cm.TooltipMode = MarkerTooltipMode.OnMouseOver;

 

It will not shown even I place my mouse on top of it. Following is the code for it:

public class MyCustomMarker : GMapMarker

    {

         private Image img;

 

        public Image MarkerImage

        {

            get { return img; }

            set { img = value; }

        }

 

        public MyCustomMarker(PointLatLng p)

            : base(p)

        {

 

        } 

        public override void OnRender(Graphics g)

        {

            g.DrawImageUnscaledAndClipped(img, new System.Drawing.Rectangle(base.LocalPosition.X, base.LocalPosition.Y, img.Width, img.Height));

        }

    }

 

           GMapOverlay top = new GMapOverlay(gMapControl1, "top");

            gMapControl1.Overlays.Add(top);

 

            MyCustomMarker cm = new MyCustomMarker(gMapControl1.CurrentPosition);

            cm.MarkerImage = new Bitmap(@"C:\bak\Gmap.net\PostData\zoomin.png");

            cm.ToolTipText = "Hei, Sumvel, Nice to see you";

            cm.TooltipMode = MarkerTooltipMode.OnMouseOver;

            //cm.ToolTipOffset = new System.Drawing.Point(0, 0);

            top.Markers.Add(cm);

            top.TooltipFont = new Font("Arial", 10, FontStyle.Bold);

 

            gMapControl1.Overlays.Add(top);

 

Any hints would be appricated.

Thanks.

Sumvel

Oct 10, 2009 at 6:21 PM

Thank you for your help and especaily the code for the custom marker. I have been on jury duty for a month (primal scream!) so I have not tested it yet. I hope to try it next week. Any other sample code on custom markers would be apprciated.

Oct 10, 2009 at 9:02 PM

you need set marker Size to make it workon mouse move events...

Oct 11, 2009 at 1:37 AM

Radioman,

Yes, when I set Marker size, it works. 

Thanks

Sumvel