views:

17

answers:

2

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) on the canvas?

A: 

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);

AlvinfromDiaspar
A: 

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.

Ragepotato