Control.TopLevelControl Control.TopLevelControl Control.TopLevelControl Control.TopLevelControl Property

定义

获取没有另一个 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; }
member this.TopLevelControl : System.Windows.Forms.Control
Public ReadOnly Property TopLevelControl As 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.

安全性

UIPermission
对于所有窗口,获取此属性值。for all windows to get this property value. 关联的枚举:AllWindowsAssociated enumeration: AllWindows

适用于

另请参阅