I'm using the ArcGIS runtime SDK for .Net, version 10.2.7.
I have a point graphic that is symbolised with a TextSymbol. I would like to add a separate polygon graphic to the graphics overlay that covers the extent of the text symbol.
What I have tried is below. It works fairly well, but there is a small difference between the text and the polygon.
var symbol = GetGraphicSymbol(); if (symbol == null) return; var text = symbol.Font; var size = graphics.MeasureString(symbol.Text, new Font(text.FontFamily, (float)text.FontSize, FontStyle.Regular, GraphicsUnit.Document)); if (size.Width == 0 || size.Height == 0) return; var width = mapView.UnitsPerPixel * size.Width; var height = mapView.UnitsPerPixel * size.Height;
I understand that on any scale change the polygon graphic would need to be recalculated.