C#自定义控件 - 拖放+对齐/对接 - 类似于Scratch / Snap [英] C# Custom Controls - Drag Drop + Snapping/Docking - like Scratch/Snap

查看:376
本文介绍了C#自定义控件 - 拖放+对齐/对接 - 类似于Scratch / Snap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简短说明:我对如何在C#中拖放可自定义控件之间实现基本捕捉功能感兴趣,从哪里开始,任何人都可以给出类似的东西等等。



为简单起见,假设按钮控制,我的应用程序中有一个按钮工具箱,用户将它们拖放到一个区域上,如果两个按钮垂直或水平放置在一起,它们就是SNAP到位 - 就像在一个网格。



=============================== ========================================

已编辑到是一个非模糊的问题





所以我想为自己制作像软件一样的软件,因为Arduino和其他机器人的东西,是的,我已经看到了不同的划痕和按扣以及所有类似的版本 - 但我想自己制作。



我知道一点C#并且是一名电子工程师,那么我该如何制作基本支持拖动/下载的自定义控件pping(我认为已经可以在C#/ .Net中使用),相互捕捉(这需要稍后进行基于类型的捕捉,但现在只需要简单的捕捉)和一个类似于我的程序中的视图的ToolBox,用户可以从那里获取那些块(这不是自定义控件部分)。



这方面的任何指针,想法和建议都很棒,我打算保持开源,这是更多的是我自己的学习练习,然后很快完成它 - 感谢您的时间和任何提前的帮助。 :)

SHORT DESCRIPTION: Am interested in how to implement basic snapping functionality among drag/drop-able custom controls in C#, where to start and can anyone give any pointers to something similar etc.

For simplicity, assume Button Control, I have a ToolBox of Buttons in my App, User drags and drops them on an area, if 2 buttons are placed CLOSE together vertically or horizontally, they SNAP in place - like in a GRID.

=======================================================================
EDITED to be a non-vague-ish question


Hi, so I am wanting to make a scratch like software on m own, for Arduino and other robotics stuff, YES, I have seen at the different variants of scratch and snap and all similar versions - but I want to make my own.

I know somewhat C# and am an electronics engineer, so how do I go about making custom controls which have basic support of dragging/dropping (I think that is already available in C#/.Net), Snapping to one another (this will need to be type based snapping later, but for now simple snapping) and a ToolBox like view in my program from where user can get those blocks (this is not the custom control part).

Any pointers, ideas, suggestions in this regard would be great, I plan to keep it open source and this is more of a learning exercise for myself then to finish it any time soon - THANKS for your time and any help in advance. :)

推荐答案

请参阅 https: //www.google.com/search?q=drag%20drop%20c%23 [ ^ ]。 Google始终是第一个搜索一般信息的地方。
See https://www.google.com/search?q=drag%20drop%20c%23[^]. Google is always the first place to search for general information.


这篇关于C#自定义控件 - 拖放+对齐/对接 - 类似于Scratch / Snap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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