GameBar.VisibilityChanged 事件

定义

在显示或关闭游戏栏时发生。

使用 事件监视游戏栏的可见性状态。 当游戏栏可见并在游戏上绘制时,游戏可以选择暂停游戏或呈现空闲状态。 暂停或空闲时,最佳做法是继续渲染当前帧或场景,以便在玩家开始录制或已经在录制时录制流畅且无缝。 多人游戏可能会选择继续玩游戏,而不是暂停。

提示

可以在后台 (非 UI) 线程引发此事件。 可能需要将事件发布到 UI 线程以执行 UI 操作。

使用 Visible 确定游戏栏当前是否可见。

// Register
static event_token VisibilityChanged(EventHandler<IInspectable> const& handler) const;

// Revoke with event_token
static void VisibilityChanged(event_token const* cookie) const;

// Revoke with event_revoker
static GameBar::VisibilityChanged_revoker VisibilityChanged(auto_revoke_t, EventHandler<IInspectable> const& handler) const;
public static event System.EventHandler<object> VisibilityChanged;
function onVisibilityChanged(eventArgs) { /* Your code */ }
Windows.Gaming.UI.GameBar.addEventListener("visibilitychanged", onVisibilityChanged);
Windows.Gaming.UI.GameBar.removeEventListener("visibilitychanged", onVisibilityChanged);
- or -
Windows.Gaming.UI.GameBar.onvisibilitychanged = onVisibilityChanged;
Public Shared Custom Event VisibilityChanged As EventHandler(Of Object) 

事件类型

适用于

另请参阅