I created an image with this code
OpenFileDialog dlg = new OpenFileDialog(); dlg.FileName = ""; // Default file name myImage = new Image(); try { Nullable<bool> result = dlg.ShowDialog(); if (result == true) { string sUri = @dlg.FileName; Uri src = new Uri(sUri, UriKind.RelativeOrAbsolute); BitmapImage bmp = new BitmapImage(src); myImage.Source = bmp; myImage.Width = 100; myImage.Height = 100; } }
I can enlarge / reduce the image on this image
public void Scale(int i, Point center) { Matrix m = myImage.RenderTransform.Value; if (i > 0) m.ScaleAtPrepend(1.1, 1.1, center.X, center.Y); else m.ScaleAtPrepend(1 / 1.1, 1 / 1.1, center.X, center.Y); myImage.RenderTransform = new MatrixTransform(m); }
but when I get ActualWidth or Width or ActualHeight / Height, the number 100 is returned. This means that these changes do not apply to the original image (myImage). Now How to apply changes (increase or any changes) to the original image?
Tanx all;
source share