I want to paint a Polygon region with a color.
I know I can use Symbolizer
to do this but I want that region to blink (change it's color in a timer) and using symbolizer
seems to be slow for this purpose.
I'm already using Map.OnPaint
event to draw a colored image of a point (in a PointLayer
).
So how can I Convert a Polygon Feature (in a PolygonLayer
) to System.Drawing.Region
so I can use methods in Graphics class to paint that region?
Thanks in advance.
Here is a demonstration. This is polygon specific, but should give you an idea of how to convert a polygon into a GraphicsPath, which you can then use to fill or draw with the Brush/Pen of your choice on the graphics object. This was only tested on a relatively simple shape, but it uses essentially the same drawing code as the MapPolygonLayer, so it should be pretty accurate. If you are in edit mode, you might want to get the vertices directly from the feature, rather than the way I got them.