When to image resize, custom lines drawn on image should also resize in wpf/c#
I have a wpf application. There is a image control that shows a image. I have put a canvas on top开发者_如何学JAVA and I draw line on it. With double click I increase the size of the image control. Hence image in it also increases to fit the image control but the size of the line drawn on the canvas does not change.
I want when I change the size of image shapes like line or rectangle, drawn on image also changes in proportion.
You have to store coords of graphical objects you draw manually.
When you resize image you have to create graphical objects from scratch changing their coords according to zoom factor.
Probably you could use Matrix
object to make it easier..
Make sure the canvas has the same initial size as the image control. When zooming the image control, just use a scale transform and apply the same scale transform to the canvas.
精彩评论