After adding a SymbolElement to a layer, I'd like to determine the on-screen location of that symbol so that I can draw a line to it from a callout displayed near the map. Is there a way to convert an origin to pixel coordinates that are relative to the viewport?
Thanks in advance!
I came up with this solution, which meets my needs (given the location of SymbolElement as "origin"):
Dim pixelX As Integer = CInt((((origin.X - Map1.WindowRect.Left) / (Map1.WindowRect.Right - Map1.WindowRect.Left)) * ((Map1.Margin.Left + Map1.ActualWidth) - Map1.Margin.Left)) + Map1.Margin.Left) Dim pixelY As Integer = CInt((((origin.Y - Map1.WindowRect.Top) / (Map1.WindowRect.Bottom - Map1.WindowRect.Top)) * ((Map1.Margin.Top + Map1.ActualHeight) - Map1.Margin.Top)) + Map1.Margin.Top)