ArcObject Redline functionality in an ArcMap Add-in

1981
1
08-16-2011 01:08 PM
PaulLivingstone
New Contributor III
Hi

I have a requirement to draw a freehand line graphic in an ArcObjects Add-in for ArcMap.
I want to simply draw on the map like drawing using a pencil in 'MS Paint'.
i.e. ringing features, creating a freehand arrow pointing to a feature on the map etc.
Then add a text description to indicate what is wrong.

Does anyone know what the best approach is for this or is this not possible?

Thanks
Paul
0 Kudos
1 Reply
DubravkoAntonic
New Contributor III
Try this if it gives you some hint of drawing
http://forums.arcgis.com/threads/36292-How-draw-a-circle-arc-into-a-srcreendisplay?p=122707#post1227...

If you need persistent graphic you need to use drawing on the Graphic layer
Try something like this

            IGraphicsContainer container = (IGraphicsContainer)IMap.BasicGraphicsLayer;
           
            LineElement line = new LineElement();
            line.Geometry = pGeometry;

            IElementProperties props = (IElementProperties)line;
            props.Name = elemName;

            ILineSymbol pLineSymbol = new SimpleLineSymbolClass();

            IRgbColor pCol = new RgbColorClass();
            pCol.Red = color.R;
            pCol.Green = color.G;
            pCol.Blue = color.B;
            pLineSymbol.Color = pCol;

            pLineSymbol.Width = lineWidth;

            ILineElement lineElement = (ILineElement)line;
            lineElement.Symbol = pLineSymbol;

            container.AddElement(line, 0);

After drawing you need to refresh graphic layer

            IActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics |
                                                esriViewDrawPhase.esriViewGraphicSelection,
                                                null, Extension.ActiveView.Extent);

Suggest to read in SDK more about drawing, without this will give you just more question then before.
0 Kudos