Shape Selection and Highlighting

Oct 20, 2011 at 10:22 PM

Hi All,

I'm new to the MapWinGIS ActiveX control and just downloaded it (v4.8RC3) for the first time yesterday. Based on many of the helpful posts on this discussion board and the documentation, I was able to put together a quick "proof of concept" using VBA within Excel.  I've managed to put in the following functionality:

  • Button to add data (shapefiles and images)
  • Button to remove data
  • Button to move data up or down in the map
  • Navigation buttons (zoom in, zoom out, zoom to extent, pan)
  • Selection tool which returns attributes to a list box

The selection tool is working to select features and put their attributes into a list box, however I can't for the life of me figure out how to get my selected features to change color when selected.  I've searched the forums and found a few posts and examples but still can't seem to get it to work.

Does anyone have a good working example that they would be willing to share? I'll gladly share what I have put together (click here to download my example) as well in case it helps anyone else.

Thanks in advance,


Oct 21, 2011 at 3:10 PM


First welcome to the community. We'll try to help you as we can.
Did you already looked at the test script (, they have a lot of sample code.

About your question. You can set the selection using

shapefile.SelectedShapes(shapeID, True)

You also might considering a different approach. Instead of adding the map to your Excel sheet, you can also create a plug-in for MapWindow that will handle your Excel sheet.
Then you don't need to create all the default functions, you can use the ones provided by MapWindow. Just a thought.

I hope it helps,


Oct 24, 2011 at 3:32 PM


Thanks, that did the trick. I knew I was missing something simple. I just had to add this to my loop:

Shapefile.ShapeSelected(ShapeID(i)) = True

I've reposted the excel file tot he same link as above with the corrected version in case anyone else finds it useful.

As for creating a plugin for MapWindow, in a perfect world if I were starting from scratch I'd probably go that route. The effort I'm currently working on is a pretty extensive preexisting excel based dashboard which they want basic GIS functionality integrated. I initially used ArcEngine to accomplish that but the overhead and cost associated with that didn't make it easily portable. The MapWinGIS ActiveX control is perfect for this.

Thanks again for the help!