组件与控制 [英] Component vs. Control

查看:58
本文介绍了组件与控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WinForms .Net控件世界中

In the world of WinForms .Net controls

组件和控件之间有什么区别?

What is the difference between Component and Control?


  • 控件可以包含任何组件吗?

  • 组件可以包含任何控件吗?

推荐答案

控件具有充当窗口所需的所有管道。响应窗口消息(WndProc)并具有最重要的Handle的能力。组件缺少所有这些。这真的很简单,它具有设计时支持设置属性的能力,就这样就可以了。

A Control has all the plumbing required to act as a window. The ability to respond to Window messages (WndProc) and having a Handle being foremost. Component is missing all that. It is really rather simple, it has design time support to set properties and it can be disposed, that's all.

组件仍然可以具有运行时表示形式,OpenFileDialog是最好的例。但这实际上是Windows内置的对话框,而不是Windows窗体。

Components still can have a runtime representation, OpenFileDialog being the best example. But that is actually a dialog built into Windows, not Windows Forms.

这篇关于组件与控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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