需要图片编辑器... [英] Require an image editor...

查看:66
本文介绍了需要图片编辑器...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我是ASP.Net的初学者,我必须使用Visual Studio 2005创建图像编辑器,在其中可以裁剪图像的某些部分并将这些部分单独(作为图像)存储在文件系统中.文件系统和数据库中包含图像的路径.
请告诉我如何尽早解决此问题..
在此先感谢您..

Hello everyone..

I am a beginner in ASP.Net and I have to make an image editor using Visual Studio 2005 where I can crop certain parts of my image and store those parts separately(as an image) in a file system..My image resides on a file system and the database contains the path of the image..

Please tell me how to go about solving this problem as early as possible..
Thanks a lot in advance..

推荐答案

由于这是家庭作业,因此我不会给您任何代码:您应该自己做点什么! :laugh:

如果您不知道该怎么做,请将其分解为较小的部分,然后尝试依次解决每个问题.当您满意某个部分的工作原理时,请继续进行下一个.因此,逻辑位为:
1)显示图像.
2)允许用户标记他想要裁剪的位
3)提取图像部分
4)保存.

1)很简单:您可以通过两种方式进行操作:PictureBox或Paint-It-Yourself.
我会自己动手绘画,因为PictureBox可能会非常有限.
1.1)声明一个类级别的Image变量,然后在构造函数中加载图片,或通过表单加载事件将其加载到其中:请参见 1.4)在paint事件处理程序方法中,PaintEventArgs参数"e"将具有一个Graphics上下文供您绘制:与Graphics.DrawImage [ Graphics.DrawRectangle [ Bitmap.Clone [ Image.Save [
Since this is homework, I''ll give you no code: you should do something yourself! :laugh:

If you don''t know how to do something, break it down into smaller pieces, and try to solve each of them in turn. When you are happy that one part works, move on to the next. So, the logical bits are:
1) Show the image.
2) Allow the user to mark the bit he wants to crop
3) Extract the image section
4) Save it.

1) is easy: there are two ways you could go: PictureBox, or Paint-It-Yourself.
I would go Paint-It-Yourself, because a PictureBox can be quite limiting.
1.1) Declare a class level Image variable, and load a picture into it in you constructor, or form load event: see the Image.FromFile[^] method
1.2) Put a Panel on your form, and size it appropriately.
1.3) Select events on the Property pane, and double click "Paint" to build a skeleton Paint event handler.
1.4) In the paint event handler method, the PaintEventArgs parameter "e" will have a Graphics context for you to draw with: use it with the Graphics.DrawImage[^] method to display the picture you loaded earlier.

2) Is a bit more complex: You need to handle three events on your panel: MouseDown, MouseUp, and MouseMove, as well as modifying your Paint event to use Graphics.DrawRectangle[^] to show the user where the crop will happen.

3) Is simple again: Bitmap.Clone[^] will do that for you.

4) And this is even easier: Image.Save[^] means you just need to decide where to put it!


这篇关于需要图片编辑器...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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