Nevron Forum

Highlighting map shapes

https://www.nevron.com/Forum/Topic4087.aspx

By Kevin Harrison - Tuesday, August 31, 2010

I have a map on which I have used a fill rule.  I want to highlight the shapes on the map as I mouse over them.  The example does this by assigning one of a small set of styles to each polygon as it is loaded, but I can't use this technique because of the fill rule.

I can't find a simple method of getting the shape's colour and changing it when the mouse enters and back again when it leaves. What do I do to achieve simple highlighting?

By Nevron Support - Tuesday, August 31, 2010

Hi,

There are 2 possible solutions:

 

1.       After the map has been imported you can see that the fill rule has created some style sheets in the document’s StyleSheets collection. You can create one more for each one of them and just change the StyleSheetName of the shape as shown in the Map Projections example.

 

2.       You can easily get the color of the style sheet of the shape that should be highlighted:

 

NStyleSheet styleSheet = (NStyleSheet)document.StyleSheets.GetChildByName(line.StyleSheetName);

NColorFillStyle colorFillStyle = (NColorFillStyle)styleSheet.Style.FillStyle;

Color color = colorFillStyle.Color;

 

Then you can use this value to calculate a highlight color and set it to the shape’s fill style. On NodeMouseLeave just restore the shape fill style to null and it will use the style sheet again.