ContentElement.QueryCursor ContentElement.QueryCursor ContentElement.QueryCursor ContentElement.QueryCursor Event


要求顯示游標時發生。Occurs when the cursor is requested to display. 每當滑鼠指標移動至新位置時,都會引發此事件,這意謂游標物件可能會根據其新位置而變更。This event is raised on an element each time that the mouse pointer moves to a new location, which means the cursor object might need to be changed based on its new position.

 event System::Windows::Input::QueryCursorEventHandler ^ QueryCursor;
public event System.Windows.Input.QueryCursorEventHandler QueryCursor;
member this.QueryCursor : System.Windows.Input.QueryCursorEventHandler 
Public Custom Event QueryCursor As QueryCursorEventHandler 


此事件建立的別名Mouse.QueryCursor附加事件,此類別中,以便QueryCursor屬於類別的成員清單時ContentElement繼承為基底的項目。This event creates an alias for the Mouse.QueryCursor attached event for this class, so that QueryCursor is part of the class members list when ContentElement is inherited as a base element. 附加至事件處理常式QueryCursor事件會附加至基礎Mouse.QueryCursor附加事件,並接收相同的事件資料執行個體。Event handlers that are attached to the QueryCursor event are attached to the underlying Mouse.QueryCursor attached event and receive the same event data instance.

此事件名稱所參考的資料指標不一定是文字游標 (有時稱為插入點)。The cursor being referred to by this event name is not necessarily the text cursor (sometimes known as the insertion point). 相反地,此內容中的資料指標是宣告螢幕上的圖形化顯示數個可能的輸入相關的裝置或在 Windows 程式設計的概念相關的物件。Instead, the cursor in this context is the object that declares the onscreen graphical display related to several possible input-related devices or concepts in Windows programming. 該物件由Cursor在 WPF 中的類別。That object is represented by the Cursor class in WPF. WPF 輸入的系統可讓您變更這個資料指標,當它表示滑鼠指標的螢幕上的位置。The WPF input system enables you to change this cursor when it represents the onscreen position of the mouse pointer. 您可以使用預先定義的值從Cursors列舉型別,或者您可以宣告為影像檔的自訂游標。You can use predefined values from the Cursors enumeration, or you can declare a custom cursor as an image file.

接聽QueryCursor事件就不會針對資料指標管理而有效率的技術。Listening for the QueryCursor event is not an efficient technique for cursor management. 相反地,每個項目應該定義自己的資料指標行為CursorForceCursorInstead, each element should define its own cursor behavior with Cursor and ForceCursor. 您只應依賴QueryCursor如果您不使用 WPF 架構層級基底項目,或在異常的情況下,其中定義每個項目為基礎的資料指標的行為不符合您的需求。You should only rely on QueryCursor if you are not using the WPF framework-level base elements, or in extraordinary circumstances where defining cursor behavior on a per-element basis does not meet your needs. 如需有關實作資料指標行為,以回應QueryCursor,請參閱QueryCursorEventHandlerFor more information on implementing cursor behavior in response to QueryCursor, see QueryCursorEventHandler.

路由事件資訊Routed Event Information

識別項欄位Identifier field QueryCursorEvent
路由策略Routing strategy 事件反昇Bubbling
Delegate - 委派Delegate QueryCursorEventHandler
  • 沒有任何已定義的對應通道事件。There is no defined corresponding tunneling event.

  • 覆寫OnQueryCursor實作在衍生類別中這個事件的類別處理。Override OnQueryCursor to implement class handling for this event in derived classes.