开发者

How to use pointerPressed method for particular image?

开发者 https://www.devze.com 2023-03-22 19:32 出处:网络
Hi Friends, I have created one canvas form & on that i placed one image which is my button registe开发者_JAVA技巧r. Now i am going to catch image touch events using pointerPressed method for only

Hi Friends, I have created one canvas form & on that i placed one image which is my button registe开发者_JAVA技巧r. Now i am going to catch image touch events using pointerPressed method for only register image button. But how can i done this? can any one give me idea how to do this. How i can detect the user touches image of register using pointerPressed method. please help me friends. Thanks


Working with CustomItem will provide your needs.


I have created one canvas form

Canvas or Form? these are totally different objects and handling pointer events would be totally different in Canvas vs Form.

given your mention of pointerPressed I suspect you're talking about Canvas right?

updated: For image drawn on Canvas (thanks for clarifying this btw), you need to know coordinates of the area it occupies, then you just need to check if x and y coordinates passed to in pointerPressed are within area occupied by your image (these are horizontal and vertical location where the pointer was pressed, relative to the Canvas - check the API docs)

0

精彩评论

暂无评论...
验证码 换一张
取 消