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. 滑鼠通常只會在拖放作業期間擷取,直到擷取拖放作業的拖放動作,就會發生。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.

此事件會使用事件反昇的路由,因為已擷取的項目可能的子項目,而非項目實際附加事件處理常式。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.

適用於

另請參閱