語言

AppWindow 類別

定義

代表一個系統管理的應用程式內容容器。

public ref class AppWindow sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class AppWindow final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class AppWindow
Public NotInheritable Class AppWindow
繼承
Object Platform::Object IInspectable AppWindow
屬性

備註

Important

標題列自訂 API 自 1.2 Windows 應用程式 SDK 起部分支援於 Windows 10,Windows 11 則完全支援。 你應該先檢查程式碼中的 AppWindowTitleBar.IsCustomizationSupported 再呼叫這些 API,以確保你的應用程式在其他 Windows 版本上不會當機。 更多資訊請參見 標題列自訂

屬性

名稱 Description
ClientSize

取得視窗客戶端區域目前的大小,並依 Win32 客戶端座標計算。

DispatcherQueue

取得與應用程式視窗相關的調度器佇列。

Id

取得應用程式視窗的識別碼。

IsShownInSwitchers

取得或設定一個值,指示此視窗是否會出現在各種系統表示中,如 ALT+TAB 和工作列。

IsVisible

會得到一個表示視窗是否被顯示的值。

OwnerWindowId

取得此視窗擁有者的識別碼;若未擁有則為0。

PersistedStateId

代表一個系統管理的應用程式內容容器。

PlacementRestorationBehavior

代表一個系統管理的應用程式內容容器。

Position

取得視窗在螢幕座標中的當前位置。

Presenter

會取得目前應用的 App 視窗呈現者。

Size

會取得視窗目前的螢幕座標大小。

Title

會取得或設定應用程式視窗的顯示標題。

TitleBar

會看到應用程式視窗的標題欄。

方法

名稱 Description
AssociateWithDispatcherQueue(DispatcherQueue)

將應用程式視窗與指定的調度者佇列關聯起來。

Create()

建立一個應用程式視窗,並將樣式和屬性設定為預設 OverlappedPresenter的 。

Create(AppWindowPresenter, WindowId, DispatcherQueue)

建立一個具有指定視窗中定義 AppWindowPresenter的樣式與屬性的視窗,為指定的視窗子級,並與指定的 DispatcherQueue視窗 相關聯。

Create(AppWindowPresenter, WindowId)

建立一個具有指定視窗中定義 AppWindowPresenter 的樣式與屬性,並作為指定視窗子系的視窗。

Create(AppWindowPresenter)

建立一個具有指定 Style 與屬性 AppWindowPresenter的視窗。

Destroy()

試圖摧毀應用程式視窗。

GetCurrentPlacement()

代表一個系統管理的應用程式內容容器。

GetFromWindowId(WindowId)

若有,WindowId則回傳 AppWindow ,並指定為 。 如果WindowId無法匹配到有效視窗,則返回null

Hide()

它會將視窗從系統中所有 UX 表示中隱藏,但物件仍然存在。

Move(PointInt32)

將視窗移動到螢幕座標中指定的點。

MoveAndResize(RectInt32, DisplayArea)

將視窗移動到指定顯示區域內的指定點,並設定為指定的大小。

MoveAndResize(RectInt32)

將視窗移動到螢幕座標中指定的點,並設定為指定的大小。

MoveInZOrderAtBottom()

將當前視窗移動為 Z 順序的底部視窗。

MoveInZOrderAtTop()

將當前視窗移動為 Z 順序中的頂端視窗。

MoveInZOrderBelow(WindowId)

將當前視窗移至Z階中指定的視窗以下。

Resize(SizeInt32)

將視窗調整到指定大小。

ResizeClient(SizeInt32)

調整視窗大小以符合客戶區域指定的大小。

SaveCurrentPlacement()

代表一個系統管理的應用程式內容容器。

SaveCurrentPlacementForAllPersistedStateIds()

代表一個系統管理的應用程式內容容器。

SetCurrentPlacement(AppWindowPlacementDetails, Boolean)

代表一個系統管理的應用程式內容容器。

SetIcon(IconId)

用指定的圖示 ID 設定視窗圖示。

SetIcon(String)

透過指定的圖示路徑設定視窗圖示。

SetPresenter(AppWindowPresenter)

將指定的呈現器套用到視窗上。

SetPresenter(AppWindowPresenterKind)

將指定的呈現者類型套用到視窗上。

SetTaskbarIcon(IconId)

用指定的圖示 ID 設定工作列的圖示。

SetTaskbarIcon(String)

依照指定的圖示路徑設定工作列圖示。

SetTitleBarIcon(IconId)

使用指定的圖示 ID 設定視窗標題列的圖示。

SetTitleBarIcon(String)

依照指定的圖示路徑設定視窗標題列的圖示。

Show()

顯示視窗並啟動。

Show(Boolean)

會顯示視窗,並有啟用或不啟用的選項。

ShowOnceWithRequestedStartupState()

顯示預設呈現者處於請求狀態的視窗。

事件

名稱 Description
Changed

當視窗的某個性質改變,系統暫時處於「穩態」時,會發生這種情況。

Closing

當系統賦能關閉視窗時,會發生這種情況。

Destroying

當窗戶被破壞時會發生。

適用於

另請參閱