Profile Picture

Highlighting map shapes

Posted By Kevin Harrison 14 Years Ago
Author
Message
Kevin Harrison
Posted 14 Years Ago
View Quick Profile
Forum Guru

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
Last Active: 12 Years Ago
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
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

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





Similar Topics


Reading This Topic