选择工具源代码 [英] Selection tool source code

查看:96
本文介绍了选择工具源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个开源的C#选择工具,其功能类似于MS Paint中的Select。您建立一个选择框,然后可以用鼠标调整它的大小。这允许你在图像上设置一个非常精确的裁剪区域。



虽然GüntherM。我看了很多代码项目文章而没有找到这样的代码。 Foidl的裁剪图像把我带到了一半。丢失的部分是在克隆图像的裁剪部分之前调整选择框的大小。



有什么建议吗?



(编辑:3/3/14 8:25 PM)

I'm searching for an open source C# selection tool that functions like Select in MS Paint. You establish a selection box and can then adjust the size of it with your mouse. This allows you to set a very precise crop area on the image.

I've looked through a bunch of Code Project articles without finding such code, although Günther M. Foidl's Cropping Images takes me halfway there. The missing piece is resizing the selection box prior to cloning the cropped portion of the image.

Any suggestions?

(Edited: 3/3/14 8:25PM)

推荐答案

我认为CodeProject确实拥有你需要的东西:Zebbleon75018的可调整大小的图形矩形[ ^ ]。这不是商业控制质量很漂亮,但它做得非常好,响应非常快。



我在FrameWork 4.5.1中使用它没有任何问题。但是,当我下载作者的源代码时,它在转换后无法在Visual Studio 2013中编译:缺少ResX文件和另一个文件。但是,只需复制'UserRect类,将其粘贴到新VS项目中的新类中,并使用它就很容易。



添加'' DoubleClick EventHandler,只需找到'SetPictureBox方法,并将EventHandler添加到'mPictureBox变量。我假设您发现将当前的裁剪代码与此控件集成很容易。
I think CodeProject does have what you need: "A Resizable Graphical Rectangle" by Zebulon75018 [^]. It's not "commercial control quality beautiful," but, it's quite well done, and very responsive.

I am using this with FrameWork 4.5.1 with no problems. However, when I downloaded the author's source code, it would not compile in Visual Studio 2013 after conversion: missing ResX file and one other file. But, it was easy enough just to copy the 'UserRect Class, paste it into a new Class in a new VS Project, and use it.

To add a 'DoubleClick EventHandler to it, just find the 'SetPictureBox method, and add the EventHandler to the 'mPictureBox variable. I assume you'd find it easy to integrate your current cropping code with this Control.


问题不在于如何裁剪图像。问题是关于可调整大小的选择框,如MS Paint中的那个。



这是我最终修改后使用的解决方案:CRACTTrackerCS [ ^ ]



Ed
The question was not about how to crop images. The question was about resizable selection boxes like the one in MS Paint.

Here is the solution I ended up modifying for my use: CRectTrackerCS[^]

Ed


这篇关于选择工具源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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