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 會將控制項設定為最上層控制項,否則為 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.

備註

如果您呼叫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.

適用於

另請參閱