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.
i have every country apart , maybe borders light when clicked
you can pretty using wpf:
- find nice world map in svg format. used this one wikipedia:
- download , install inkscape open svg you've downloaded. inkscape has nice feature makes possible save svg xaml.
- import
viewbox
xaml file wpf window/etc:
- for each
path
in xaml can addmouseenter
/mouseleave
event handler or can use same 1path
s
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); } }