简体   繁体   English

画布上的形状在哪里?

[英]Where is the Shape located on Canvas?

Say I put a Shape on a Canvas like this: 假设我在画布上放置了一个Shape,如下所示:

Canvas.SetLeft(myShape, 50);
Canvas.SetTop(myShape, 30);
canvas.Children.Add(myShape);

After that, myShape was drag & dropped on this Canvas. 之后,将myShape拖放到此Canvas上。

How can I determine the current myShape coordinates ? 如何确定当前的myShape坐标?

For example, before the drag & drop I would like to get (50,30). 例如,在拖放之前,我想得到(50,30)。 Thanks ! 谢谢 !

var left = Canvas.GetLeft(myShape);
var top = Canvas.GetTop(myShape);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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