SelectionColor doesn't seem to be behaving properly

Odd one, this, I’m sure I’ve not seen it before! To set the scene I’m using MapWinGIS in Excel via vba and version 5.1.1

Plonk a polygon shapefile on a map, colour the shapefile a nice solid blue, set the SelectionColor to a solid yellow and select a shape or two - the result is GREEN!!! - fade the shape’s blue transparency to 100 and the selected shape does become yellow so it’s looking like the selection colour is blended with the generic shape colour - is this expected behaviour? (I’d have thought not)

Edit: Partly My Bad, I forgot that transparence runs between 0 and 255, a true solid yellow trumps a 50% blue any day of the week! Even so, if I wanted to see the whole underlying map I’d expect that a 50% transparency for both would give see-through blue for the unselected areas and see-through yellow when selected rather than a mixture of 50% blue and 50% yellow!

Hello @PipzUK

I ran across a similar scenario recently. Here is what’s happening inside the code, be it good or bad.

There are two ways to set up the Selection Appearance.

tkSelectionAppearance.saSelectionColor

  1. You only set the SelectionColor and the SelectionTransparency
  2. The selected features are drawn first, then the selection is drawn on top. This results in the Green color when the selection transparency is down low enough.

tkSelectionAppearance.saDrawingOptions

  1. You can set many more drawing properties in the SelectionDrawingOptions class (including differing line colors and widths, etc).
  2. However, the selected features are NOT drawn - only the selection is drawn. The comments in the code indicate the assumption is that since you are able to specify so much detail, there’s no need to draw twice. So it substitutes the SelectionDrawingOptions for the DefaultDrawingOptions. Interestingly, this would result in only seeing your selected shapes in the Transparent Yellow rather than the Green.

I have mixed feelings about this behavior. When selecting point features that use an image (icon or png), I like seeing the image below and the transparent selection box on top. If I use saDrawingOptions, I lose my icon and I only see a small ‘selected’ dot. So I had to stay with the saSelectionColor option.

The short of it is that you may want to use the saDrawingOptions method to get the behavior you’re looking for.

Regards,
Jerry.

@jerryfaust, thanks for the explanation - I remember with horror the day DefaultDrawingOptions “arrived” in MapWinGIS (a VERY long time ago!) and I steadfastly stuck to the deprecated method as (for my purposes) the new way seemed like using a sledgehammer to crack a nut! My background is with Arcview 3 (that yellow as selection colour is a dead giveaway!), that didn’t have shape transparency and in those pre online tiles days we used a local monochrome tiff map base with transparency so the map base was usually drawn over polygons (with maybe an unfilled duplicate copy drawn on top to re-draw the outlines over the map) so if the colours had blended with transparency it would have been in a place I just didn’t go! I’ve also now noticed that the saSelectionColor option doesn’t draw the border of the shape either so the newfangled method is definitely the way I’ll have to go - even though it’s an awful lot of extra code for my simple needs :grinning:

Edit: Well, that wasn’t quite the baptism of fire that my first glance at the class documentation seemed to suggest! - Thanks for your help.