Image with Multiple Clickable Areas

淺唱寂寞╮ 提交于 2020-01-03 03:11:46

问题


I have an image that I want various parts of to be clickable. I found a comment in the question below mentioning this was possible with Expression Designer. I haven't been able to find a guide on how to do this. I understand that I have to export the image from Designer to Visual Studio. Is there a better way of achieving this or how do I go about creating the xaml for these clickable sections?

best way for clickable image map in wpf


回答1:


Personally I'd use the second answer to that question i.e. do something like this:

<Canvas>
    <Image Source="background.png"/>
    <Ellipse Canvas.Left="82" Canvas.Top="88" Width="442" Height="216" Fill="Transparent" Cursor="Hand" MouseDown="Ellipse_MouseDown_1"/>
    <Ellipse Canvas.Left="305" Canvas.Top="309" Width="100" Height="50" Fill="Transparent" Cursor="Hand" MouseDown="Ellipse_MouseDown_2"/>
</Canvas>

Then you can drag and resize the shapes in DevStudio using it's XAML editor's design mode.



来源:https://stackoverflow.com/questions/20318601/image-with-multiple-clickable-areas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!