开发者

two questions about rectangle and canvas in silverlight 4

I have a rectangle on canvas. I can already moving this object using with mouse, but I can't find how can I resize it in runtime using mouse too? And second question, how can I programatically check positions of each objects (e.g rectangles) 开发者_Go百科on the canvas?


Most people use a Thumb. This is an msdn article that shows you how to use a thumb to resize a canvas. The same principles can be applied to your rectangle.


Re-sizing a rectangle using the mouse can be pretty involved. Basically you can listen for mouse-down, mouse-up, and mouse-move events which would allow you to adjust the width and height of it programmatically.

To move a rectangle within the canvas, try the following concept:

double x = Canvas.GetLeft(this.myRectangle); x += 100; Canvas.SetLeft(this.myRectangle, x);

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜