This is a migrated thread and some comments may be shown as answers.

How can I change the Cursor based on clickable country?

1 Answer 43 Views
Map
This is a migrated thread and some comments may be shown as answers.
Bing
Top achievements
Rank 1
Bing asked on 21 Aug 2011, 11:47 PM
Hi Guys

I need change the Cursor based on each countries information. How can I do it?

Thanks in advance
Bing

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 24 Aug 2011, 04:05 PM
Hello Bing,

You can use the MouseEnter and MouseLeave events of the map shape object and shape's extended data. For example:

polygon.MouseEnter += new MouseEventHandler(this.ShapeMouseEnter);
polygon.MouseLeave += new MouseEventHandler(this.ShapeMouseLeave);
 
private Cursor oldCursor;
 
private void ShapeMouseEnter(object sender, MouseEventArgs e)
{
    MapShape shape = sender as MapShape;
    if (shape != null)
    {
        ExtendedData data = shape.ExtendedData;
        if ((string)data.GetValue("Name") == "USA")
        {
            oldCursor = this.Cursor;
            this.Cursor = Cursors.Hand;
        }
    }
}
 
private void ShapeMouseLeave(object sender, MouseEventArgs e)
{
    MapShape shape = sender as MapShape;
    if (shape != null)
    {
        this.Cursor = oldCursor;
    }
}

Greetings,
Andrey Murzov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Map
Asked by
Bing
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or