C# .NET WinForms控件类

C# .NET WinForms控件类,c#,.net,winforms,controls,C#,.net,Winforms,Controls,WinForms应用程序中显示的所有窗口和控件(包括active-x)是否都来自System.windows.Forms.Control类?基本上是的 但是,非可视组件(如计时器)是从组件(或实现IComponent)派生的。只有像按钮和窗体这样的可视元素是从控件派生的 另外,ActiveX控件不是从控件本身派生的,因为它们是COM组件;相反,当您导入ActiveX控件时,VisualStudio会生成一个从AxHost派生并承载COM对象的包装器。(AxHost本身确实源于控件。)我认为您应该

WinForms应用程序中显示的所有窗口和控件(包括active-x)是否都来自System.windows.Forms.Control类?

基本上是的

但是,非可视组件(如计时器)是从组件(或实现IComponent)派生的。只有像按钮和窗体这样的可视元素是从控件派生的


另外,ActiveX控件不是从控件本身派生的,因为它们是COM组件;相反,当您导入ActiveX控件时,VisualStudio会生成一个从AxHost派生并承载COM对象的包装器。(AxHost本身确实源于控件。)

我认为您应该看看

继承层次

系统..::.Object

系统..::.MarshalByRefObject

System.ComponentModel..::.Component

 System.Windows.Forms..::.Control

   System.Windows.Forms..::.AxHost

   System.Windows.Forms..::.ButtonBase

   System.Windows.Forms..::.DataGrid

   System.Windows.Forms..::.DataGridView

   System.Windows.Forms..::.DateTimePicker

   System.Windows.Forms..::.GroupBox

   System.Windows.Forms.Integration..::.ElementHost

   System.Windows.Forms..::.Label

   System.Windows.Forms..::.ListControl

   System.Windows.Forms..::.ListView

   System.Windows.Forms..::.MdiClient

   System.Windows.Forms..::.MonthCalendar

   System.Windows.Forms..::.PictureBox

   System.Windows.Forms..::.PrintPreviewControl

   System.Windows.Forms..::.ProgressBar

   System.Windows.Forms..::.ScrollableControl

   System.Windows.Forms..::.ScrollBar

   System.Windows.Forms..::.Splitter

   System.Windows.Forms..::.StatusBar

   System.Windows.Forms..::.TabControl

   System.Windows.Forms..::.TextBoxBase

   System.Windows.Forms..::.ToolBar

   System.Windows.Forms..::.TrackBar

   System.Windows.Forms..::.TreeView

   System.Windows.Forms..::.WebBrowserBase