共用方式為


IUIAnimationStoryboard2::SetStoryboardEventHandler 方法 (uianimation.h)

指定文稿事件的處理程式。

語法

HRESULT SetStoryboardEventHandler(
  [in, optional] IUIAnimationStoryboardEventHandler2 *handler,
  [in]           BOOL                                fRegisterStatusChangeForNextAnimationEvent,
  [in]           BOOL                                fRegisterUpdateForNextAnimationEvent
);

參數

[in, optional] handler

每當文稿狀態和更新事件發生時,Windows 動畫應該呼叫的處理程式。

指定的對象必須實作 IUIAnimationStoryboardEventHandler2 介面或 為 NULL。 如需詳細資訊,請參閱。

[in] fRegisterStatusChangeForNextAnimationEvent

如果為 TRUE,則註冊 OnStoryboardStatusChanged 事件,並在 IUIAnimationManager2::EstimateNextEventTime 中包含這些事件,這會估計下一個動畫事件之前的時間間隔。 無預設值。

[in] fRegisterUpdateForNextAnimationEvent

如果為 TRUE,則註冊 OnStoryboardUpdated 事件,並在 IUIAnimationManager2::EstimateNextEventTime 中包含這些事件,這會估計時間間隔直到下一個動畫事件為止。 無預設值。

傳回值

如果成功 則傳回S_OK;否則 為 HRESULT 錯誤碼。 如需錯誤碼的清單,請參閱 Windows 動畫錯誤碼

備註

傳遞處理程序參數的 NULL 會導致 Windows Animation 釋放其先前傳入之任何處理程式對象的參考。 這項技術對於中斷參考週期而言可能很重要,而不需要呼叫 IUIAnimationManager2::Shutdown 方法。

規格需求

需求
最低支援的用戶端 Windows 8、適用於 Windows 7 的 Windows 7 和平臺更新 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 都不支援
目標平台 Windows
標頭 uianimation.h
Dll UIAnimation.dll

另請參閱

IUIAnimationStoryboard2

IUIAnimationStoryboardEventHandler2