我希望在图像上方的画布上裁剪图像(例如在orkut中) [英] i want a canvas on top of my image to crop the image(like in orkut)

查看:116
本文介绍了我希望在图像上方的画布上裁剪图像(例如在orkut中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将画布放置在以表格形式加载的图像上.它应该可以帮助用户选择所需的尺寸来裁剪图像,就像我们在上传照片时在orkut中裁剪照片一样.


希望这会很容易.


我需要使用C#.

在此先感谢

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

推荐答案

写道:​​

希望这会很容易.

hope it will be easy.



不,不会.

只需放置一个将图片加载到背景中的div,然后在其上方放置另一个div.

允许用户使用鼠标指针调整div的大小.当您将表单发布到服务器时,您将获得所需的div尺寸.只需使用Basic Bitmap对象在服务器端裁剪图像:



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;




我希望你能做到.
:rose:




I hope you can do it.
:rose:


据您所知,我不在ASP.net站点上工作,而是在Windows应用程序(c#)上工作,所以我不能使用DIV标记.而且我的程序没有客户端与服务器的交互.它是一个独立的应用程序.


而且最主要的是,我需要将不在所选区域中的图像评估为暗淡或焦点不清晰.

我希望您能理解这一点.
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.


为什么实际上没有人知道答案按钮是用于发布答案的?编辑您的信息以添加详细信息.

为此,方法是处理鼠标事件以跟踪所需的区域,然后绘制四个矩形以遮盖未选中的区域,方法是使用带有画笔的画笔在绘画事件中绘制它们,以绘制未选中的区域.透明度不超过0.5或更低.
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.


这篇关于我希望在图像上方的画布上裁剪图像(例如在orkut中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆