I'm working with Visual Studio 2008 and I have created a window with a Canvas in a ScrollViewer. On the canvas, I've placed an image and the code I've written places buttons on the canvas at certain locations. So far, so good, but I'm trying to implement
a zooming method which scales the canvas and the image, but leaves the buttons intact in terms of size and content -- however, their location
should scale together with the image and the canvas.
What I have thusfar is this:
private void zoomIn(Object sender, MouseButtonEventArgs e)
mapCanvas.Width *= ZoomFactor;
mapCanvas.Height *= ZoomFactor;
Zoom *= ZoomFactor;
TransformGroup transform = new TransformGroup();
transform.Children.Add(new ScaleTransform(Zoom, Zoom));
transform.Children.Add(new TranslateTransform(0, 0));
mapCanvas.RenderTransform = transform;
This, together with an analogue zoomOut method, works like a charm, but the buttons are scaled as well, obviously because RenderTransform is applied to every child of the canvas as well.
My question is: how can I leave the buttons unscaled?
View Complete Post