Form.CenterToParent Form.CenterToParent Form.CenterToParent Form.CenterToParent Method

定义

使窗体在父窗体边界内居中。Centers the position of the form within the bounds of the parent form.

protected:
 void CenterToParent();
protected void CenterToParent ();
member this.CenterToParent : unit -> unit
Protected Sub CenterToParent ()

注解

不要直接从代码CenterToParent中调用方法。Do not call the CenterToParent method directly from your code. 相反,请将StartPosition属性设置CenterParent为。Instead, set the StartPosition property to CenterParent.

如果窗体或对话框是顶级窗体或对话框CenterToParent ,则将窗体围绕屏幕或桌面居中。If the form or dialog is top-level, then CenterToParent centers the form with respect to the screen or desktop.

适用于

另请参阅