/// <summary> /// This method is used to draw the customization of label. /// </summary> /// <param name="sender">This is object of maps control.</param> /// <param name="e">This is event args parameter.</param> private void MapsControl1_AnnotationDrawing(object sender, AnnotationDrawingEventArgs e) { var font = new Font("Segoe UI", (int)DpiAware.LogicalToDeviceUnits(12F), FontStyle.Regular, GraphicsUnit.Pixel, ((byte)(0))); StringFormat format = new StringFormat(); format.FormatFlags = StringFormatFlags.FitBlackBox; var location = (e.Annotation as Annotation); e.Handled = true; PointF point = new PointF((float)e.X, (float)e.Y); e.Graphics.DrawString(location.AnnotationLabel, font, location.AnnotationStroke, new PointF(point.X + 10, point.Y + 3)); }
void mapsControl1_AnnotationDrawing(object sender, AnnotationDrawingEventArgs e) { var font = new Font("Segoe UI", 18F, FontStyle.Regular, GraphicsUnit.Pixel, ((byte)(0))); var font1 = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Pixel, ((byte)(0))); StringFormat format = new StringFormat(); format.FormatFlags = StringFormatFlags.FitBlackBox; var location = (e.Annotation as SyncfusionLocations); e.Handled = true; PointF point = new PointF((float)e.X, (float)e.Y); Image img = Image.FromFile("..//..//pin.png"); e.Graphics.DrawImage(img, point.X - 10, point.Y - 25, 20, 30); e.Graphics.FillRectangle(new SolidBrush(Color.DarkCyan), new RectangleF(point.X + 5, point.Y + 2, 100, 30)); e.Graphics.DrawString(location.Name, font, new SolidBrush(Color.White), new PointF(point.X + 10, point.Y + 3)); }