This project is read-only.

How to make polygons transparent

Apr 20, 2011 at 2:05 PM

I have a shape file containing set of polygons displayed as a layer on my map.

However, I want the polygon fill to be transparent and can't seem to get MapWindow to do this.

I've tried calls on the layer and on individual shapes:

    Map.set_ShapeLayerFillTransparency(polyLayer, 80);

    Map.set_ShapeFillTransparency(polyLayer, shapeNumber, 80);

and neither seem to work.  I also tried using a 0.8 instead of 80, which didn't make any difference either.

Any pointers as to how to make this correctly show transparent polygons?

Many thanks,


Apr 20, 2011 at 6:07 PM

Built the latest code and tried that.  The transparency now works (used Map.set_ShapeLayerFillTransparency(polyLayer, 0.5f)).

However, the line thickness and image list point functionality no longer seems to be working...


Apr 21, 2011 at 10:04 AM

Following a bit of reading through the code, I think the line-width issue is a bug in CMapView::SetShapeLayerLineWidth.  It looks like the "if" clause is backwards to me.


I think this method should read:

    if( newValue < 0.0 )
            newValue = 0.0;

    if (m_ShapeDrawingMethod == dmNewSymbology)
        CDrawingOptionsEx* options = get_ShapefileDrawingOptions(LayerHandle);
        if (options)
            options->lineWidth = newValue;
            m_canbitblt = FALSE;
            if( !m_lockCount )
        Layer * l = get_ShapefileLayer(LayerHandle);
        if (l)
            ShapeLayerInfo * sli = (ShapeLayerInfo*)l->addInfo;
            sli->lineWidth = newValue;

            register int i;
            long endcondition = sli->shapeInfo.size();
            for( i = 0; i < endcondition; i++ )
                sli->shapeInfo[i]->lineWidth = newValue;

            m_canbitblt = FALSE;