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如果调用true的方法Formfalse传入值,则窗体将不可见,直到再次调用SetTopLevel并传入的值。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. 关联的AllWindows UIPermissionWindow枚举: 值。Associated enumeration: AllWindows value of UIPermissionWindow.

适用于

另请参阅