Mouse.Captured 属性

定义

获取捕获了鼠标的元素。

public:
 static property System::Windows::IInputElement ^ Captured { System::Windows::IInputElement ^ get(); };
public static System.Windows.IInputElement Captured { get; }
static member Captured : System.Windows.IInputElement
Public Shared ReadOnly Property Captured As IInputElement

属性值

由鼠标捕获的元素。

示例

以下示例演示如何获取具有鼠标捕获的 元素。

// Mouse.Capture returns an IInputElement.
IInputElement captureElement;

captureElement = Mouse.Captured;

// Update the Label that displays the element with mouse capture.
lblHasMouseCapture.Content = captureElement.ToString();
' Mouse.Capture returns an IInputElement.
Dim captureElement As IInputElement

captureElement = Mouse.Captured

' Update the Label that displays the element with mouse capture.
lblHasMouseCapture.Content = CType(captureElement, Object).ToString()

注解

当元素捕获鼠标时,无论光标是否在其边框内,它都会接收鼠标输入。 通常仅在拖放操作期间以这种方式捕获鼠标,并保留捕获,直到拖放操作的放置操作发生。

适用于