简体   繁体   English

如何创建特定类型的用户控件

[英]How to create a specific type of user control

I am trying to create a winForms user control. 我正在尝试创建一个winForms用户控件。 But I want would like a User control that - when placed on the form -- doesn't take any form space. 但是我想要一个用户控件-当放置在窗体上时-不占用任何窗体空间。 Instead, it lodges itself nicely below like OpenFileDialog does. 相反,它像OpenFileDialog一样很好地放置在下面。

First, what kind of user-created thing is this? 首先,这是用户创建的哪种东西? Is it still called a "user control"? 它仍然被称为“用户控件”吗? If not, that may explain why all of my searches are in vain. 如果没有,那也许可以解释为什么我所有的搜索都是徒劳的。 Secondly, what object do I need to start with to create something like this? 其次,我需要从哪个对象开始创建类似的东西?

A gentle shove in the right direction would be VERY appreciated. 朝正确方向轻轻推一下将非常感激。

Thanks. 谢谢。

--Jerry - 杰瑞

Controls that appear in the "component tray", like the Windows Forms Timer control, inherit from Component. 出现在“组件托盘”中的控件(例如Windows Forms Timer控件)从Component继承。

To create one with some automatic boilerplate code, right-click on a project and click Add... | 若要创建带有一些自动样板代码的代码,请在项目上单击鼠标右键,然后单击“添加...”。 Component 零件

我相信您在谈论创建Component

Okay... I KNEW that... I feel an inch tall now. 好吧...我知道...我现在感到一英寸高。

I would love to retract the question and hide my stupidity, but I think I'll leave it up for everyone else who may be asking the same question and just need a gentle reminder, too. 我很想撤消这个问题并掩盖我的愚蠢,但我想我会把这个问题留给其他所有人,他们可能会问同样的问题,也只需要轻轻地提醒一下。

Thanks for the whack on the noggin!! 谢谢你的点头!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM