Permalink
Browse files

Load full image as preview when opened

  • Loading branch information...
1 parent e3d9c03 commit a381bcbf596ced5c18cd46f262772f70c67798fd @kamranayub kamranayub committed Feb 22, 2013
Showing with 44 additions and 39 deletions.
  1. +44 −39 ImageShrinker/Window1.xaml.cs
@@ -352,6 +352,8 @@ private void NewImageDisplayed()
Win8StoreLogo100.Fill = null;
myCanvas.Children.Remove(rectFrame);
+
+ UpdatePreviewIcons(new Point(0, 0), new Point(imageSource.Width, imageSource.Height));
}
private string IsSingleFile(DragEventArgs args)
@@ -431,48 +433,51 @@ private void UC_MouseMove(object sender, MouseEventArgs e)
rectFrame.RenderTransform = new TranslateTransform(lt.X, lt.Y);
myCanvas.Children.Add(rectFrame);
- // Icon Images
- Point sourceLt = new Point(lt.X * scale, lt.Y * scale);
- Point sourceRb = new Point(rb.X * scale, rb.Y * scale);
-
- ImageBrush brush = new ImageBrush();
- brush.ImageSource = imageSource;
- brush.Viewbox = new Rect(sourceLt, sourceRb);
- brush.ViewboxUnits = BrushMappingMode.Absolute;
- brush.Stretch = Stretch.Fill;
-
- // WP7
- Wp7Icon300.Fill = brush;
- Wp7Icon173.Fill = brush;
- Wp7Icon62.Fill = brush;
-
- // WP8
- Wp8AppIcon.Fill = brush;
- Wp8FlipMedium.Fill = brush;
- Wp8FlipSmall.Fill = brush;
-
- // Win8
- Win8Logo180.Fill = brush;
- Win8Logo140.Fill = brush;
- Win8Logo100.Fill = brush;
- Win8Logo80.Fill = brush;
-
- Win8SmallLogo180.Fill = brush;
- Win8SmallLogo140.Fill = brush;
- Win8SmallLogo100.Fill = brush;
- Win8SmallLogo80.Fill = brush;
- Win8SmallLogoTarget256.Fill = brush;
- Win8SmallLogoTarget48.Fill = brush;
- Win8SmallLogoTarget32.Fill = brush;
- Win8SmallLogoTarget16.Fill = brush;
-
- Win8StoreLogo180.Fill = brush;
- Win8StoreLogo140.Fill = brush;
- Win8StoreLogo100.Fill = brush;
-
+ UpdatePreviewIcons(lt, rb);
}
}
+ private void UpdatePreviewIcons(Point lt, Point rb) {
+ // Icon Images
+ Point sourceLt = new Point(lt.X*scale, lt.Y*scale);
+ Point sourceRb = new Point(rb.X*scale, rb.Y*scale);
+
+ ImageBrush brush = new ImageBrush();
+ brush.ImageSource = imageSource;
+ brush.Viewbox = new Rect(sourceLt, sourceRb);
+ brush.ViewboxUnits = BrushMappingMode.Absolute;
+ brush.Stretch = Stretch.Fill;
+
+ // WP7
+ Wp7Icon300.Fill = brush;
+ Wp7Icon173.Fill = brush;
+ Wp7Icon62.Fill = brush;
+
+ // WP8
+ Wp8AppIcon.Fill = brush;
+ Wp8FlipMedium.Fill = brush;
+ Wp8FlipSmall.Fill = brush;
+
+ // Win8
+ Win8Logo180.Fill = brush;
+ Win8Logo140.Fill = brush;
+ Win8Logo100.Fill = brush;
+ Win8Logo80.Fill = brush;
+
+ Win8SmallLogo180.Fill = brush;
+ Win8SmallLogo140.Fill = brush;
+ Win8SmallLogo100.Fill = brush;
+ Win8SmallLogo80.Fill = brush;
+ Win8SmallLogoTarget256.Fill = brush;
+ Win8SmallLogoTarget48.Fill = brush;
+ Win8SmallLogoTarget32.Fill = brush;
+ Win8SmallLogoTarget16.Fill = brush;
+
+ Win8StoreLogo180.Fill = brush;
+ Win8StoreLogo140.Fill = brush;
+ Win8StoreLogo100.Fill = brush;
+ }
+
#endregion MouseMove
}

0 comments on commit a381bcb

Please sign in to comment.