创建自定义的WinForms容器 [英] Create custom winforms container

查看:130
本文介绍了创建自定义的WinForms容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创造的WinForms具有相同的行为容器控件的控件。 我的意思是:在设计模式,当我把它控制,它会组,然后,就像一个组框

I want to create a control in winforms with same behavior as the container controls. I mean: in design mode, when I drop controls in it, it will group then, just like a groupbox.

这控制我创建包含其他一些控件和一个分组框。 所有我需要的是:当一个控制DROP掉在设计模式了我的自定义控制,我只是把它嵌套分组框里面

This control I'm creating contains some other controls AND a GroupBox. All I need is: when a control is droped in design mode over my custom control, I'll just put it inside the nested GroupBox.

但我不知道如何让我的控制响应那种在设计模式中的作用。

But I can't figure out how make my control respond to that kind of action in design mode.

推荐答案

可能的这个是你需要什么,我发现它在$ C $的CProject时间前:

Maybe this is what you need, I found it at CodeProject a time ago:

设计嵌套控件:

本文演示了如何让一个控制,这是一个孩子   另一种控制接受其控制在设计跌落到它   时间。它不是一个大的文章,也没有太大的由code方式,和   这可能不是任何官方或最好做这种方式。确实如此,   然而,工作,是稳定的,据我已经能够测试它。

This article demonstrates how to allow a Control, which is a child of another Control to accept having controls dropped onto it at design time. It is not a large article, there is not much by way of code, and this may not be either the 'official' or best way to do this. It does, however, work, and is stable as far as I have been able to test it.

这篇关于创建自定义的WinForms容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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