This project has moved and is read-only. For the latest updates, please go here.

Coloring/Highlighting Features

Feb 10, 2010 at 4:22 PM

I am successfully now doing Intersections to find features - and then coloring the feature using this:

    HighlightLayer = new SharpMap.Layers.VectorLayer("HighlightLayer");
    HighlightLayer.DataSource = new SharpMap.Data.Providers.GeometryProvider(rowSelected.Geometry);
    HighlightLayer.Style.Outline = System.Drawing.Pens.Green;
    HighlightLayer.Style.EnableOutline = true;       
    HighlightLayer.Style.Fill = new System.Drawing.SolidBrush(Color.Green);

If the rowSelected is a Polygon, I successfully paint and fill the polygon green.

If the rowSelected is a Poly Line, the Line does not get colored.

What else do I need to do in the case of a Poly Line Shape?      Thank you.



Feb 10, 2010 at 4:33 PM

Hi Frank set the styles Line property to a Pen.. cheers jd

Feb 10, 2010 at 4:39 PM

Hi John,

Ah - you beat me to it.  :)  I was just coming back here to make my first contribution - and answer my own question:

        HighlightLayer.Style.Line = new Pen(Color.Green, 7);
        HighlightLayer.Style.Line.StartCap = System.Drawing.Drawing2D.LineCap.Round;
        HighlightLayer.Style.Line.EndCap = System.Drawing.Drawing2D.LineCap.Round;
        HighlightLayer.Style.Outline = new Pen(Color.Green, 7);
        HighlightLayer.Style.Line.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
        HighlightLayer.Style.EnableOutline = true;