简体   繁体   中英

How to get Position of Ellipse in WPF C#?

I am creating a bubbles game, that there is a lot of bubbles on the screen moving and i want to pop a bubble when i click on it with mouse.

I can get the position of Mouse easily but i don't know how to get the position of the ellipse in order to check the intersection with the point of the mouse.

Any ideas about how to get the position of ellipses ?!!

I am using Canvas as my container.

Canvas.GetTop(myEllipse);
Canvas.GetLeft(myEllipse);

How to set ellipse position on Canvas using mouse position

为什么不在Ellipse上处理PreviewMouseDown(和/或PreviewMouseUp),而不是试图根据位置找到点击的椭圆?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM