c# - Click on image and show message box depending on the clicked place -


i have idea of world map image , when click country on it, shows information of country in messagebox example have idea how that?

i have rectangle , button , when click button shows image in rectangle thought if use polygons shape country's i'm little stuck.

world map

i have every country apart , maybe borders light when clicked

you can pretty using wpf:

  1. find nice world map in svg format. used this one wikipedia:

world map wikipedia

  1. download , install inkscape open svg you've downloaded. inkscape has nice feature makes possible save svg xaml.

inkscape save dialog

  1. import viewbox xaml file wpf window/etc:

vs xaml editor

  1. for each path in xaml can add mouseenter/mouseleave event handler or can use same 1 paths

sample code:

 private void countrymouseenter(object sender, mouseeventargs e)  {      var path = sender path;      if (path != null)      {          path.fill = new solidcolorbrush(colors.aqua);      }  }   private void country_mouseleave(object sender, mouseeventargs e)  {      var path = sender path;      if (path != null)      {          path.fill = new solidcolorbrush(colors.black);      }  } 
  1. now it's matter of changing colors/showing messageboxes etc.

    demo

github


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo