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.

public:
 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 

備註

這個事件QueryCursor會為這個類別建立Mouse.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. 該物件是由 WPF 中Cursor的類別表示。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. 相反地, 每個元素都應該使用CursorForceCursor來定義自己的資料指標行為。Instead, 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.

適用於

另請參閱