UIElement.GotMouseCapture UIElement.GotMouseCapture UIElement.GotMouseCapture UIElement.GotMouseCapture Event

定義

此元素擷取滑鼠時發生。Occurs when this element captures the mouse.

public:
 virtual event System::Windows::Input::MouseEventHandler ^ GotMouseCapture;
public event System.Windows.Input.MouseEventHandler GotMouseCapture;
member this.GotMouseCapture : System.Windows.Input.MouseEventHandler 
Public Custom Event GotMouseCapture As MouseEventHandler 

實作

備註

當專案捕捉到滑鼠時, 即使滑鼠指標位於其範圍外, 也會收到滑鼠輸入。When an element captures the mouse, it receives mouse input even if the mouse pointer is outside its bounds. 通常只有在拖放作業期間才會捕捉到滑鼠, 而且會一直被捕捉到拖放操作的 drop 動作。The mouse is typically captured only during drag-and-drop operations and remains captured until the drop action of the drag-and-drop operation occurs.

因為此事件使用反升路由, 所以具有 capture 的元素可能是子項目, 而不是實際附加事件處理常式的專案。Because this event uses bubbling routing, the element that has capture might be a child element instead of the element where the event handler is actually attached. 檢查事件Source資料中的, 以判斷具有滑鼠捕捉的實際元素。Check the Source in the event data to determine the actual element that has mouse capture.

這個事件會為這個類別建立Mouse.GotMouseCapture附加事件的別名, 因此當GotMouseCapture繼承為基底專案時UIElement , 就是類別成員清單的一部分。This event creates an alias for the Mouse.GotMouseCapture attached event for this class so that GotMouseCapture is part of the class members list when UIElement is inherited as a base element. 附加至GotMouseCapture事件的事件處理常式會附加至基礎Mouse.GotMouseCapture附加事件, 並接收相同的事件資料實例。Event handlers that are attached to the GotMouseCapture event are attached to the underlying Mouse.GotMouseCapture attached event and receive the same event data instance.

路由事件資訊Routed Event Information

識別碼欄位Identifier field GotMouseCaptureEvent
路由策略Routing strategy 路由Bubbling
Delegate - 委派Delegate MouseEventHandler
  • 沒有已定義的對應通道事件。There is no defined corresponding tunneling event.

  • OnGotMouseCapture寫以在衍生類別中為這個事件執行類別處理。Override OnGotMouseCapture to implement class handling for this event in derived classes.

適用於

另請參閱