问题描述
我有一张我希望其各个部分都可单击的图像。我在下面的问题中找到一条评论,提到这可以通过Expression Designer实现。我还没有找到有关此操作的指南。我知道我必须将图像从Designer导出到Visual Studio。有没有更好的方法来实现这一目标,或者我该如何为这些可点击部分创建xaml?
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?
推荐答案
我个人将使用该问题的第二个答案,即执行以下操作:
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>
然后,您可以使用XAML编辑器的设计模式在DevStudio中拖动并调整形状的大小。
Then you can drag and resize the shapes in DevStudio using it's XAML editor's design mode.
这篇关于具有多个可点击区域的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!