Control.SetTopLevel(Boolean) Control.SetTopLevel(Boolean) Control.SetTopLevel(Boolean) Control.SetTopLevel(Boolean) Method

定义

将控件设置为顶级控件。Sets the control as the top-level control.

protected:
 void SetTopLevel(bool value);
protected void SetTopLevel (bool value);
member this.SetTopLevel : bool -> unit
Protected Sub SetTopLevel (value As Boolean)

参数

value
Boolean Boolean Boolean Boolean

true 表示将控件设置为顶级控件;false 表示不作此设置。true to set the control as the top-level control; otherwise, false.

异常

value参数设置为true和控件是 ActiveX 控件。The value parameter is set to true and the control is an ActiveX control.

GetTopLevel()返回值不等于value参数和Parent属性不是nullThe GetTopLevel() return value is not equal to the value parameter and the Parent property is not null.

注解

如果调用SetTopLevel方法Form中的一个值,然后传入false,窗体在您调用之前将不可见SetTopLevel再次,传递的值中trueIf you call the SetTopLevel method of a Form and pass in a value of false, the form will not be visible until you call SetTopLevel again, passing in a value of true.

安全性

UIPermission
若要将控件设置为顶级控件,如果它不是任何类型的Formto set the control as a top-level control if it is of any type other than Form. 如果仅需要此权限value参数是true和控件不是 ActiveX 控件。This permission is only demanded if the value parameter is true and the control is not an ActiveX control. 关联枚举:AllWindows的值UIPermissionWindowAssociated enumeration: AllWindows value of UIPermissionWindow.

适用于

另请参阅