tags:

views:

152

answers:

2

I'm working on a small project that involves me loading an image into a picture box within a windows form. I then need to be able to select and area of this image, and "crop" to that size - kind of like you can do in MS Paint.

I was just wondering if anyone knew of any sample code available to help me start this?

+3  A: 

I've had luck with this code:

Cropping Images

Jay Riggs
+2  A: 

It is a pretty simple problem. You need to handle MouseDown, MouseUp, and keep track of when you start and stop dragging your selection rectangle. Now that you have done that you already have the selection rect, so just use that to take a portion of the whole image. If you are displaying a scaled version just find the ratio between the control's dimensions and the dimensions of the image.

Ed Swangren