Silverlight 4 : Resize Dynamic Rectangles Using Thumb -


xaml

<canvas x:name="cvsburstimage" mouseleftbuttondown="cvsburstimage_mouseleftbuttondown" style="{staticresource burstcanvasstyle}">    <viewbox x:name="vbburstimage" style="{staticresource viewboxcanvasstyle}">             <image x:name="imgburstimage" source="../assets/images/default_burst_image.png" imagefailed="imgburstimage_imagefailed"/>    </viewbox>                                    </canvas> 

i facing strange problem need draw rectangles on canvas , make them resizable as moveable (place them anywhere in canvas).

i have achieved via mouse events of canvas;

  1. private void canvas_mouseleftbuttondown(object sender,mousebuttoneventargs e) {}
  2. private void canvas_mousemove(object sender, mouseeventargs e) {}
  3. private void canvas_mouseleftbuttonup(object sender, mousebuttoneventargs e) {}

explanation; on mouseleftbuttondown, start capturing mouse cordinates , continue doing mouse move (make height , width these cordinates), on mouseleftbuttonup stop listening mouse , draw these cordinates rectangle on canvas , add rectangle canvas child element. add 3 mouse events rectangle;

  1. private void rectangle_mouseleftbuttonup(object sender, mousebuttoneventargs e)
  2. private void rectangle_mousemove(object sender, mouseeventargs e)
  3. private void rectangle_mouseleftbuttondown(object sender, mousebuttoneventargs e)

these events use identify given rectangle (rectangle_mouseleftbuttondown) , move rectangle mouse cordinates (rectangle_mousemove) , stop listening @ (rectangle_mouseleftbuttonup).

now, have add resize feature in rectangle. wish achieve using thumb, unable achieve this.

can please me out this. in advance.

adding reusable functionality directly objects seems bit wasteful.

why not use behaviour this one? that's sort of thing for. decorated handles etc.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -