画布上的形状在哪里? [英] Where is the Shape located on Canvas ?

查看:192
本文介绍了画布上的形状在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


假设我将这样的形状放在画布上:

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


之后,将myShape拖放到放在此画布上.
如何确定当前myShape坐标?
例如,在拖动&我想得到(50,30).
谢谢!

感谢您的回答!
1.您能否举例说明通过设置形状的边距来设置形状的位置?
2.在画布上指定形状坐标的最常用方法是什么?我会期望像这样:canvas.Children.Add(myShape, 50, 30),但是我看不到这种方法.

解决方案

我将通过设置顶部和左侧边距来设置位置形状,然后检查这些属性.


Canvas.GetLeft和Canvas.GetTop.


糟糕-那里的小脑屁.

Hi,
Say I put a Shape on a Canvas like this:

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


After that, myShape was drag & dropped on this Canvas.
How can I determine the current myShape coordinates ?
For example, before the drag & drop I would like to get (50,30).
Thanks !

Thanks for your answers !
1. Could you please show me an example of setting the position of the Shape by setting it''s margins ?
2. What is the most used method to specify the Shape coordinates on a Canvas ? I would expect something like: canvas.Children.Add(myShape, 50, 30), but I don''t see such method.

解决方案

I would set the position by setting the top and left margin of the shape, then I would check those properties.


Canvas.GetLeft and Canvas.GetTop.


Ooops - small brain fart there.


这篇关于画布上的形状在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆