Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. An unhandled exception of type 'System.ArgumentException' occurred in PresentationCore.dll
  2.  
  3. Additional information: Value does not fall within the expected range.
  4.  
  5. Rect rect1 = new Rect(Canvas.GetLeft(selectionRectangle), Canvas.GetTop(selectionRectangle), selectionRectangle.Width, selectionRectangle.Height);
  6. System.Windows.Int32Rect rcFrom = new System.Windows.Int32Rect();
  7. rcFrom.X = (int)((rect1.X) * (image1.Source.Width) / (image1.Width));
  8. rcFrom.Y = (int)((rect1.Y) * (image1.Source.Height) / (image1.Height));
  9. rcFrom.Width = (int)((rect1.Width) * (image1.Source.Width) / (image1.Width));
  10. rcFrom.Height = (int)((rect1.Height) * (image1.Source.Height) / (image1.Height));
  11. **BitmapSource bs = new CroppedBitmap(image1.Source as BitmapSource, rcFrom);**
  12. image2.Source = bs;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement