Click here to Skip to main content
15,888,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a canvas to be placed on the image which i load in the form. It should assist the user to choose the desired size to crop the image like how we do in orkut to crop our photo when we upload it.


hope it will be easy.


i need in c#.

thanks in advance
Posted

wrote:
hope it will be easy.


No it will be not.

Just place a div which loads the image in the background, and place another div just over it.

Allow the user to resize the div using mouse pointer. when you post the form to the server, you will get the desired dimention of the div. Just crop the image in the server side using Basic Bitmap object :

Rectangle rect = new Rectangle(cropX, cropY, cropWidth, cropHeight);
Bitmap cropped = bitmap.Clone(rect, bitmap.PixelFormat);
return cropped;



I hope you can do it.
:rose:
 
Share this answer
 
To your information, i am not working on a ASP.net Site, i am working on a WIndows application(c#), so i cant work with DIV tags. and my program has no Client-server interaction. its a standalone application.


And also the main thing is i need the image which is not in the selected area to be appreared as dull or out of focus.

i hope you can understand this.
 
Share this answer
 
v2
Why on earth can no-one work out that the answer button is for posting answers ? Edit your post to add details.

The way to do this, is to handle the mouse events to track the area you want, then draw four rectangles to obscure the area not selected, which you'd do by drawing them in your paint event, using a brush that had an opacity around .5 or less.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900