Highlighting map shapes


Author
Message
Kevin Harrison
Kevin Harrison
Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)Forum Guru (52 reputation)
Group: Forum Members
Posts: 52, Visits: 1

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?


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

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.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search