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 會將控制項設定為最上層控制項,否則為 falsetrue 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. 只有在 true value 參數且控制項不是 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.

適用於

另請參閱