Window.WindowStartupLocation 屬性

定義

取得或設定視窗第一次顯示時的位置。

public:
 property System::Windows::WindowStartupLocation WindowStartupLocation { System::Windows::WindowStartupLocation get(); void set(System::Windows::WindowStartupLocation value); };
public System.Windows.WindowStartupLocation WindowStartupLocation { get; set; }
member this.WindowStartupLocation : System.Windows.WindowStartupLocation with get, set
Public Property WindowStartupLocation As WindowStartupLocation

屬性值

WindowStartupLocation 值,指定視窗第一次顯示的上方/左側位置。 預設為 Manual

備註

WindowStartupLocation將 屬性設定為 會導致 Manual 視窗根據其 LeftTop 屬性值定位。 Left如果未指定 或 Top 屬性,則其值是由 Windows 決定。

WindowStartupLocation將 屬性設定為 CenterScreen 會導致視窗位於包含滑鼠游標的畫面中央。

WindowStartupLocation將 屬性設定為 會導致 CenterOwner 視窗位於其擁有者視窗的中心, (如果指定,請參閱 Window.Owner) 。 擁有者視窗可以是另一個 WPF 視窗或非 WPF 視窗。

注意

如需具有非 WPF 視窗之 WPF 視窗的詳細資訊,請參閱 WPF 和 Win32 交互操作WindowInteropHelper

如果未指定擁有者視窗,則會以與 WindowStartupLocation 屬性設定 Manual 為 相同的方式來決定視窗的位置。

注意

當視窗裝載于瀏覽器中時,您無法設定或取得此屬性的值。

適用於