Control.TopLevelControl 属性

定义

获取没有另一个 Windows 窗体控件作为其父级的父控件。Gets the parent control that is not parented by another Windows Forms control. 通常,这是控件所在的最外面的 FormTypically, this is the outermost Form that the control is contained in.

public:
 property System::Windows::Forms::Control ^ TopLevelControl { System::Windows::Forms::Control ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Control TopLevelControl { get; }
[<System.ComponentModel.Browsable(false)>]
member this.TopLevelControl : System.Windows.Forms.Control
Public ReadOnly Property TopLevelControl As Control

属性值

Control

Control,它表示包含当前控件的顶级控件。The Control that represents the top-level control that contains the current control.

属性

注解

顶级控件被定义为不是由另一个 Windows 窗体控件作为父级的父控件。The top-level control is defined as the parent control that is not parented by another Windows Forms control. 通常,这是控件所在的最外面的 FormTypically, this is the outermost Form that the control is contained in. 例如,如果控件包含在 MDI 子级上 Form ,则顶级控件为多文档界面 (MDI) 父级 FormFor example, if the control is contained on an MDI child Form, then the top-level control is the Multiple Document Interface (MDI) parent Form. 如果控件不是的父级,则 Form 此属性将返回 nullIf the control is not parented on a Form, this property will return null.

适用于

另请参阅