在图像中创建可点击区域?
我必须实现一个我不确定如何继续的解决方案,因为我不太了解这种语言(C#)。
I have to implement a solution for which I'm not really sure how to proceed as I don't know this language (C#) very well.
让我解释一下:
目标是让某些东西允许用户从一个项目中选择一个区域(具有圆形形式)。
所以这个想法是在区域上放了一个带有数字的图像(所以最后它看起来像一个时钟),并从用户点击的数字中获取区域。
Let me explain : The goal is to have something that allows the user to choose a zone from an item (which has a circular form). So the idea was put an image with numbers on the zone (so in the end it would look like a clock), and get the zone from the number the user would click.
所以我的问题是:是否可以在图像中创建可点击区域?
(或者如果你有这个功能的另一个解决方案,我是开放的)
So my question is : is it possible to create clickable zones in an image ? (Or if you have another solution for this functionnality, I'm open-minded)
提前致谢!
编辑>>这是针对WinForm应用程序,而不是网站。
EDIT >> This is for a WinForm application, not a website.
谢谢大家的支持答案,其中有一些有趣的东西。
Thanks you all for your answers, there are interesting things in them.
不幸的是,由于我必须快速开发这个,我只是创建了一个图像,我将在其上捕获onclick事件然后捕获用户使用Cursor.Position单击的区域,如下所示:
Unfortunately, as I had to develop this very fast, I just created an image on which I would catch the onclick event and then catch the zones the user clicked using Cursor.Position like this :
int X = pictureBox.PointToClient(Cursor.Position).X;
int Y = pictureBox.PointToClient(Cursor.Position).Y;
可能不是更干净的方式,但它有效!
无论如何,谢谢!
Maybe not the "cleaner" way to do it, but it works ! Thanks anyway !