namespace Demo.WindowsForms { using System.Windows.Forms; using GMap.NET.WindowsForms; using System.Drawing; using System; using System.Globalization; /// /// custom map of GMapControl /// public class Map : GMapControl { public long ElapsedMilliseconds; #if DEBUG private int counter; readonly Font DebugFont = new Font(FontFamily.GenericSansSerif, 14, FontStyle.Regular); readonly Font DebugFontSmall = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold); DateTime start; DateTime end; int delta; protected override void OnPaint(PaintEventArgs e) { start = DateTime.Now; base.OnPaint(e); end = DateTime.Now; delta = (int)(end - start).TotalMilliseconds; } /// /// any custom drawing here /// /// protected override void OnPaintOverlays(System.Drawing.Graphics g) { base.OnPaintOverlays(g); g.DrawString(string.Format(CultureInfo.InvariantCulture, "{0:0.0}", Zoom) + "z, " + MapProvider + ", refresh: " + counter++ + ", load: " + ElapsedMilliseconds + "ms, render: " + delta + "ms", DebugFont, Brushes.Blue, DebugFont.Height, DebugFont.Height + 20); //g.DrawString(ViewAreaPixel.Location.ToString(), DebugFontSmall, Brushes.Blue, DebugFontSmall.Height, DebugFontSmall.Height); //string lb = ViewAreaPixel.LeftBottom.ToString(); //var lbs = g.MeasureString(lb, DebugFontSmall); //g.DrawString(lb, DebugFontSmall, Brushes.Blue, DebugFontSmall.Height, Height - DebugFontSmall.Height * 2); //string rb = ViewAreaPixel.RightBottom.ToString(); //var rbs = g.MeasureString(rb, DebugFontSmall); //g.DrawString(rb, DebugFontSmall, Brushes.Blue, Width - rbs.Width - DebugFontSmall.Height, Height - DebugFontSmall.Height * 2); //string rt = ViewAreaPixel.RightTop.ToString(); //var rts = g.MeasureString(rb, DebugFontSmall); //g.DrawString(rt, DebugFontSmall, Brushes.Blue, Width - rts.Width - DebugFontSmall.Height, DebugFontSmall.Height); } #endif } }