Reputation: 607
I currently have a Image in my project, onto which I have placed a rectangle (which moves when you press arrow keys). What I aim to do is to let the user move this rectangle to show which area of the image is to be the result after cropping. See below for screenshot. The rectangle is W:60;H:150;
What I want to happen next is for a button to be clicked, and the area which the rectangle covers to be transferred into another image container sized the same as the rectangle.
So far I could not achieve this after scouring google... Would any of you be kind enough to assist?
Thanks!
Upvotes: 4
Views: 5588
Reputation: 20471
You need to use CroppedBitmap class
<CroppedBitmap x:Key="croppedImage"
Source="{StaticResource masterImage}" SourceRect="30 20 105 50"/>
replace the sourcerect with the rect coordinates of your rectangle
Upvotes: 1