When I draw a开发者_运维问答n image, I know I could find out whether the user clicks on it by comparing X,Y of mouse with position and size of that image. However is there a quicker way? I know for two rectangles there is an intersect methods. Thanks
Ultimately, the same thing has to happen. The point coordinates need to be tested against the rectangle coordinates. But if you already have Rectangle r and Point p, you can do if (r.Contains(p))
.
Not sure if this is possible (as I'm a bit unclear on what you are trying to accomplish), but maybe you can put a button behind the area you want to make clickable and assign an image to that button.
精彩评论