Control.SetTopLevel(Boolean) 方法

定义

将控件设置为顶级控件。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

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.

注解

如果调用了 FormSetTopLevel 方法并传入了 false的值,则在再次调用 SetTopLevel 之前,该窗体将不可见,并传入 true的值。If 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
如果为,则将控件设置为顶级控件(如果该控件的类型不是 Form)。to 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. 关联枚举: UIPermissionWindowAllWindows 值。Associated enumeration: AllWindows value of UIPermissionWindow.

适用于

另请参阅